form.d.ts 767 B

123456789101112131415161718192021222324252627
  1. import React from 'react';
  2. import { FieldValues, FormProps } from './types';
  3. /**
  4. * Form component to manage submission.
  5. *
  6. * @param props - to setup submission detail. {@link FormProps}
  7. *
  8. * @returns form component or headless render prop.
  9. *
  10. * @example
  11. * ```tsx
  12. * function App() {
  13. * const { control, formState: { errors } } = useForm();
  14. *
  15. * return (
  16. * <Form action="/api" control={control}>
  17. * <input {...register("name")} />
  18. * <p>{errors?.root?.server && 'Server error'}</p>
  19. * <button>Submit</button>
  20. * </Form>
  21. * );
  22. * }
  23. * ```
  24. */
  25. declare function Form<T extends FieldValues, U extends FieldValues | undefined = undefined>(props: FormProps<T, U>): React.JSX.Element;
  26. export { Form };
  27. //# sourceMappingURL=form.d.ts.map