UNPKG

@payfit/unity-components

Version:

25 lines (24 loc) • 927 B
/** * `Form` is a form wrapper bound to the form context. * It prevents the default browser submission, delegates to the form * `handleSubmit`, and then invokes the provided `onSubmit` (if any). * * Behavior: * - `onSubmit` handler: prevents default, calls `form.handleSubmit(event)`, then * forwards the event to the user-provided `onSubmit`. * - Exposes a standard `<form>` element API via `ComponentProps<'form'>`. * * Usage: * ```tsx * function Example() { * const form = useUnityForm<{ name: string }>({ validators: {} }) * return ( * <Form> * <form.AppField name="name">{() => <Input />}</form.AppField> * </Form> * ) * } * ``` */ declare const Form: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, "ref"> & import('react').RefAttributes<HTMLFormElement>>; export { Form };