import { default as React } from 'react'; import { DefaultValues, UseFormReturn } from 'react-hook-form'; import { z, ZodObject } from 'zod'; export type FormProps> = { /** * The text contents of the cancel button. * * @default Cancel */ cancelButtonLabel?: string | undefined; /** * Content to render within the element. * * In advanced use cases you may specify a function that will be invoked to render your children. * The render function receives an object that includes the internal form context object returned * by `react-hook-form#useForm()`. Note that this functionality is advanced and not unstable, and * it may change at any time. * * @experimental Passing a render function as children is unstable functionality. */ children?: React.ReactNode | ((props: { context: UseFormReturn>; }) => React.ReactNode) | undefined; /** * A class property to attach to the element. * * @see {@link !Element.className} */ className?: string | undefined; /** * A list of default class names that are applied to the form element. By default, the form is a * flexbox with consistent gapping applied between each of its elements; if you need to disable * this behavior, you can set this to `false`. * * @see {@link !Element.className} */ defaultClassName?: string | string[] | false | undefined; /** * A set of initial values used to pre-fill the form. */ defaultValues?: DefaultValues> | undefined; /** * A callback function invoked when a user clicks the "Save" button. * * The submit button is not displayed by default; you must pass the `onSubmit` props for it to * appear. */ onSubmit?: ((data: z.infer) => Promise | void) | undefined; /** * A callback function invoked when a user clicks the "Cancel" button. * * The cancel button is not displayed by default; you must pass the `onCancel` prop for it to * appear. */ onCancel?: (({ reset }: { reset: () => void; }) => void) | undefined; /** * Whether or not the form should be disabled. When disabled, all form field children and any * interactive elements (e.g. buttons) are disabled. * * @default false */ disabled?: boolean | undefined; /** * By default, the form will automatically determine whether or not it's in a loading state. For * example: The form will automatically enter a loading state during submission. * * You can override this behavior by explicitly specifying the `loading` prop. */ loading?: boolean | undefined; /** * A Zod schema used to validate the form. */ schema?: Schema | undefined; /** * The text contents of the submit button. * * @default Save */ submitButtonLabel?: string | undefined; /** * An optional title for the form */ title?: string | undefined; }; /** * A `Form` collects information from a user. * * ![Form](./screenshots/form.png) * * @param props * @see {@link Checkbox} * @see {@link FormField} * @see {@link FormFieldSecret} * @see {@link Select} * @example * ```tsx * import { Form, FormField, FormFieldSecret } from "@netlify/sdk/ui/react/components"; * *
console.log("Form submitted.", { fields })}> * * * * * * ``` */ export declare const Form: >(props: FormProps & { ref?: React.ForwardedRef | undefined; }) => JSX.Element; //# sourceMappingURL=Form.d.ts.map