API reference
Conform API reference
Conform form validation
- Identifiers
- 103
- With full guides
- 58
- Types
- 7
Topics covered
- Progressive enhancement
- useForm & useField
- Zod integration
- Server validation
- Nested fields
- Field arrays
- Accessibility
- Next.js integration
Component
| Name | What it does |
|---|---|
FormProvider | |
FormStateInput | FormStateInput renders a hidden input that preserves Conform form state across document reloads. Use it inside FormProvider when full progressive enhancement must retain validation errors and other state. |
Function
| Name | What it does |
|---|---|
getFormProps | getFormProps returns the props needed to make a native form element accessible. It reduces repetitive prop wiring and supports options for controlling generated ARIA attributes. |
getInputProps | getInputProps turns Conform field metadata into the props for an accessible native input. Its options control input type, default-value handling, and ARIA attributes. |
parseWithZod | Parses FormData or URLSearchParams with a Zod schema and returns a Conform submission result. Successful submissions expose parsed data; unsuccessful ones contain validation errors. |
getZodConstraint | getZodConstraint introspects a Zod schema and returns field-level validation attributes. Pass the result to Conform's useForm constraint option to derive native form constraints automatically. |
getCollectionProps | |
getSelectProps | |
getTextareaProps | getTextareaProps generates props for an accessible native textarea from Conform field metadata. Options customize defaultValue and ARIA attributes. |
getFieldset | getFieldset() returns child field metadata for a nested object. Call it on the parent field metadata; child names are inferred automatically. |
parseWithValibot | parseWithValibot validates FormData or URLSearchParams with a Valibot schema and returns Conform's submission overview. It supports schema factories, parse options, and configurable automatic coercion. |
getFieldsetProps | getFieldsetProps derives the properties needed to make a native fieldset accessible from Conform field metadata. Options customize generated ARIA behavior. |
getButtonProps | getButtonProps generates props for Conform intent buttons. These props let a submitted button request operations such as validating, resetting, updating, inserting, or removing form data. |
parseWithYup | parseWithYup validates submitted FormData or URLSearchParams against a Yup schema and returns a Conform submission overview. It supports synchronous validation by default and asynchronous Yup validation when configured. |
getYupConstraint | getYupConstraint converts a Yup schema into per-field validation attributes. Pass its result to useForm through the constraint option. |
conformZodMessage | conformZodMessage provides special messages that control how Conform handles Zod validation. It supports skipping a check while keeping the previous result or marking validation undefined so Conform falls back to the server. |
getFormElement | |
isInput | |
requestIntent | |
unstable_coerceFormValue | |
report | Creates a SubmissionResult from a parsed submission, optionally attaching validation errors and controlling returned values. It can reset the form, strip files, or hide sensitive fields. |
validateConstraint | |
isFieldElement | |
focusFirstInvalidField |
Hook
| Name | What it does |
|---|---|
useForm | |
useField | useField is a React hook that reads field metadata from a FormProvider. It supports reusable field components and can target a specific form with formId. |
useInputControl | useInputControl connects custom or controlled inputs to Conform. It exposes the current value plus helpers that simulate input, change, focus, and blur events. |
unstable_useControl | useControl connects a custom React UI to a hidden native form control so Conform can observe values and browser-like events. It is intended for widgets such as date pickers, rich selects, and toggles. |
useFieldList | |
useFormMetadata | useFormMetadata is a React hook that reads a form's metadata from FormProvider context. Supply the matching form ID to access the same metadata object returned by useForm. |
Type Alias
| Name | What it does |
|---|---|
FormMetadata | |
FieldMetadata | |
FormOptions | |
SubmissionResult | SubmissionResult is the result shape Conform uses to synchronize a processed form submission with form state. It can include the processed submission, an applied target value, validation errors, and a reset instruction. |
Submission | |
DefaultValue | DefaultValue is the type used for initial Conform form data. It accepts a partial object matching the form shape or a URLSearchParams object. |
FieldName | FieldName is a branded string type for Conform field names. It improves TypeScript inference and checks that names passed to reusable components match the expected field and form shapes. |
Intent | |
FormControl | |
Constraint |
Const
| Name | What it does |
|---|---|
progressive enhancement | Conform's progressive enhancement keeps HTML forms functional without depending on JavaScript, then layers on client-side behavior when available. It can preserve submission state and validation feedback across server responses and reloads. |
nested objects | Conform supports nested objects and arrays through structured field names: dot notation for object properties and bracket notation for array indices. Use getFieldset() for nested object fields and combine it with getFieldList() for nested arrays. |
array fields | Conform models array fields with bracket-index naming and exposes repeated items through getFieldList(). The generated item metadata supplies names automatically and works with insert, remove, and reorder intents. |
controlled inputs | useInputControl connects controlled or custom React inputs to Conform by exposing their current value and helpers that simulate native input events. |
accessibility attributes | Conform's accessibility support derives IDs, validation attributes, and ARIA relationships for forms and fields. Its helpers reduce the boilerplate needed to apply these properties to native HTML controls. |
type coercion | |
schema integration | Pass a Standard Schema-compatible schema as the first useForm argument to enable validation and schema-derived type inference. Conform validates it before onValidate and exposes the parsed result through ctx.schemaValue when successful. |
Module
| Name | What it does |
|---|---|
intent.insert | The insert intent adds a new item to an array field without submitting the form. It can append or place the item at an index, initialize it directly, or populate it from another validated field. |
intent.remove | |
intent.reorder | Conform's reorder intent moves an item within a field list. Generate button props with the list name and the item's current and target indexes, then attach them to a form button. |
intent.replace | |
intent.reset | |
intent.validate | The validate intent runs Conform validation for a specific field or the entire form. It can be used through a validation button or dispatched directly, such as from a blur handler. |
intent.update | Conform's update intent changes a field, including nested or list fields, through an intent button. Pass the target field name and replacement value to form.update.getButtonProps. |
Pipe
| Name | What it does |
|---|---|
form.id | form.id is Conform's generated identifier for a form. Put it on the <form> element and pass it to components that need to associate themselves with that form. |
form.errors | form.errors contains validation errors for the whole form, rather than for an individual field. Render it as a form-level summary and connect that summary to the form for accessibility. |
form.valid | form.valid is Conform form metadata indicating whether the form currently has no validation errors. Use it for conditional error summaries, submit UI, and form-level accessibility attributes. |
form.dirty | form.dirty is a boolean returned by useForm that indicates whether any considered form field has been focused at least once. Configure shouldDirtyConsider to exclude fields such as CSRF tokens. |
form.value | |
form.status | form.status tells you the result of the form's latest submission. It is undefined before submission, then success or error. |
form.key | |
field.name | |
field.errors | field.errors is the optional validation error attached to a Conform field. Render it conditionally and connect the message to the input with the field’s generated errorId. |
field.valid | field.valid is a boolean field-metadata property that reports whether the field currently has no validation errors. Use it for conditional styling and accessibility state such as aria-invalid. |
field.value | |
field.initialValue | field.initialValue is the starting value exposed by Conform field metadata. Use it to initialize uncontrolled controls or calculate their initial checked state. |
field.key | field.key is the React key exposed by Conform field metadata. Assign it to the corresponding input element so React can track that field element correctly. |
field.descriptionId | field.descriptionId is Conform's generated ID for associating a field with its descriptive help text through aria-describedby. Put it on the description element and pass it to the field's ARIA description attribute. |
field.errorId | field.errorId is a generated ID for a field's validation-error element. Use it with aria-describedby to associate the error text with the corresponding form control. |
field.dirty | |
fields | |
allErrors | |
lastResult | lastResult supplies useForm with the latest server submission result. Conform uses it to initialize and synchronize form state, including server-side validation feedback. |
defaultValue | |
constraint | |
shouldValidate | |
shouldRevalidate | |
onValidate | onValidate is the useForm callback for custom form validation and revalidation. It receives a validation context and returns a validation result, commonly from a schema parser. |
onSubmit | useForm's onSubmit callback runs before form submission and receives the submit event plus submission data. It is also the form-level handler required to enable Conform's client validation. |
defaultNoValidate | defaultNoValidate controls native constraint validation before the form is hydrated. It defaults to true; the returned form.noValidate indicates whether browser validation is disabled after hydration. |
form.allErrors | form.allErrors is a field-metadata record of validation errors, keyed by field name. Flatten its values to render all messages for a field. |
form.context | |
form.getFieldset | getFieldset() returns the child-field metadata for a nested object. Call it on the parent field metadata to access nested fields with names inferred automatically. |
form.getFieldList | getFieldList() returns metadata for every item in an array field. Use the result to render repeatable controls with automatically inferred names and stable keys. |
form.update | form.update provides an intent for changing a field or form value through a Conform control. Its generated button props support nested/list updates and can clear validation errors. |
form.reset | form.reset is a Conform form intent for restoring the entire form or a specific field, including nested and list fields. Use its button-props helper to wire a reset control into the form. |
form.validate | form.validate triggers Conform validation for a form field or the whole form. It can be called directly, including from a blur handler, or used to configure a validation button. |
form.insert | form.insert creates an intent for adding an item to an array field. Use its generated button props for a declarative control, or invoke the intent directly for imperative behavior. |
form.remove | |
form.reorder | form.reorder creates button props for moving an item within an array field. Provide the list name and the item’s current and destination indexes. |
field.getFieldset | field.getFieldset() returns metadata for the child fields of a nested object. Child field names are inferred automatically from the parent field path. |
field.getFieldList | Returns the field metadata objects for the items of an array field. Item names are inferred from the parent field, making dynamic list rendering straightforward. |
field.formId | |
field.allValid | |
field.allErrors | field.allErrors exposes all validation errors associated with a field, including errors attached to nested or indexed paths. Collect and flatten its values when rendering a complete error list. |
field.required | |
field.min | |
field.max | |
field.minLength | |
field.maxLength | |
field.pattern | |
field.multiple | |
field.step | field.step is field metadata for an input's HTML step constraint. It can be wired directly to step or included through getInputProps. |
Search across every package and filter by type in your dashboard.
Start learning