--- id: createFormFactory title: createFormFactory --- ### `createFormFactory` ```tsx export function createFormFactory( opts?: FormOptions, ): FormFactory ``` A function that creates a new `FormFactory` instance. - `opts` - Optional form options and a `listen` function to be called with the form state. ### `FormFactory` A type representing a form factory. Form factories provide a type-safe way to interact with the form API as opposed to using the globally exported form utilities. ```tsx export type FormFactory = { useForm: (opts?: FormOptions) => FormApi useField: UseField Field: FieldComponent } ``` - `useForm` - A custom composition that creates and returns a new instance of the `FormApi` class. - `useField` - A custom composition that returns an instance of the `FieldApi` class. - `Field` - A form field component.