UNPKG

1.64 kBTypeScriptView Raw
1import * as React from 'react';
2import { List, useWatch } from 'rc-field-form';
3import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
4import type { Options } from 'scroll-into-view-if-needed';
5import type { SizeType } from '../config-provider/SizeContext';
6import type { ColProps } from '../grid/col';
7import type { FeedbackIcons } from './FormItem';
8import useForm, { type FormInstance } from './hooks/useForm';
9import type { Variant } from './hooks/useVariants';
10import type { FormLabelAlign } from './interface';
11export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
12 required: boolean;
13}) => React.ReactNode);
14export type FormLayout = 'horizontal' | 'inline' | 'vertical';
15export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form'> {
16 prefixCls?: string;
17 colon?: boolean;
18 name?: string;
19 layout?: FormLayout;
20 labelAlign?: FormLabelAlign;
21 labelWrap?: boolean;
22 labelCol?: ColProps;
23 wrapperCol?: ColProps;
24 form?: FormInstance<Values>;
25 feedbackIcons?: FeedbackIcons;
26 size?: SizeType;
27 disabled?: boolean;
28 scrollToFirstError?: Options | boolean;
29 requiredMark?: RequiredMark;
30 /** @deprecated Will warning in future branch. Pls use `requiredMark` instead. */
31 hideRequiredMark?: boolean;
32 rootClassName?: string;
33 variant?: Variant;
34}
35declare const Form: (<Values = any>(props: React.PropsWithChildren<FormProps<Values>> & React.RefAttributes<FormInstance<Values>>) => React.ReactElement) & Pick<React.FC<{}>, "displayName">;
36export { List, useForm, useWatch, type FormInstance };
37export default Form;
38
\No newline at end of file