Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

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

NameWhat it does
FormProviderComponent
FormStateInputFormStateInput 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

NameWhat it does
getFormPropsgetFormProps returns the props needed to make a native form element accessible. It reduces repetitive prop wiring and supports options for controlling generated ARIA attributes.
getInputPropsgetInputProps turns Conform field metadata into the props for an accessible native input. Its options control input type, default-value handling, and ARIA attributes.
parseWithZodParses FormData or URLSearchParams with a Zod schema and returns a Conform submission result. Successful submissions expose parsed data; unsuccessful ones contain validation errors.
getZodConstraintgetZodConstraint 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.
getCollectionPropsFunction
getSelectPropsFunction
getTextareaPropsgetTextareaProps generates props for an accessible native textarea from Conform field metadata. Options customize defaultValue and ARIA attributes.
getFieldsetgetFieldset() returns child field metadata for a nested object. Call it on the parent field metadata; child names are inferred automatically.
parseWithValibotparseWithValibot validates FormData or URLSearchParams with a Valibot schema and returns Conform's submission overview. It supports schema factories, parse options, and configurable automatic coercion.
getFieldsetPropsgetFieldsetProps derives the properties needed to make a native fieldset accessible from Conform field metadata. Options customize generated ARIA behavior.
getButtonPropsgetButtonProps generates props for Conform intent buttons. These props let a submitted button request operations such as validating, resetting, updating, inserting, or removing form data.
parseWithYupparseWithYup 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.
getYupConstraintgetYupConstraint converts a Yup schema into per-field validation attributes. Pass its result to useForm through the constraint option.
conformZodMessageconformZodMessage 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.
getFormElementFunction
isInputFunction
requestIntentFunction
unstable_coerceFormValueFunction
reportCreates 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.
validateConstraintFunction
isFieldElementFunction
focusFirstInvalidFieldFunction

Hook

NameWhat it does
useFormHook
useFielduseField is a React hook that reads field metadata from a FormProvider. It supports reusable field components and can target a specific form with formId.
useInputControluseInputControl connects custom or controlled inputs to Conform. It exposes the current value plus helpers that simulate input, change, focus, and blur events.
unstable_useControluseControl 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.
useFieldListHook
useFormMetadatauseFormMetadata 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

NameWhat it does
FormMetadataType Alias
FieldMetadataType Alias
FormOptionsType Alias
SubmissionResultSubmissionResult 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.
SubmissionType Alias
DefaultValueDefaultValue is the type used for initial Conform form data. It accepts a partial object matching the form shape or a URLSearchParams object.
FieldNameFieldName 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.
IntentType Alias
FormControlType Alias
ConstraintType Alias

Const

NameWhat it does
progressive enhancementConform'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 objectsConform 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 fieldsConform 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 inputsuseInputControl connects controlled or custom React inputs to Conform by exposing their current value and helpers that simulate native input events.
accessibility attributesConform'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 coercionConst
schema integrationPass 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

NameWhat it does
intent.insertThe 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.removeModule
intent.reorderConform'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.replaceModule
intent.resetModule
intent.validateThe 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.updateConform'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

NameWhat it does
form.idform.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.errorsform.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.validform.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.dirtyform.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.valuePipe
form.statusform.status tells you the result of the form's latest submission. It is undefined before submission, then success or error.
form.keyPipe
field.namePipe
field.errorsfield.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.validfield.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.valuePipe
field.initialValuefield.initialValue is the starting value exposed by Conform field metadata. Use it to initialize uncontrolled controls or calculate their initial checked state.
field.keyfield.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.descriptionIdfield.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.errorIdfield.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.dirtyPipe
fieldsPipe
allErrorsPipe
lastResultlastResult supplies useForm with the latest server submission result. Conform uses it to initialize and synchronize form state, including server-side validation feedback.
defaultValuePipe
constraintPipe
shouldValidatePipe
shouldRevalidatePipe
onValidateonValidate 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.
onSubmituseForm'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.
defaultNoValidatedefaultNoValidate 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.allErrorsform.allErrors is a field-metadata record of validation errors, keyed by field name. Flatten its values to render all messages for a field.
form.contextPipe
form.getFieldsetgetFieldset() 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.getFieldListgetFieldList() returns metadata for every item in an array field. Use the result to render repeatable controls with automatically inferred names and stable keys.
form.updateform.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.resetform.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.validateform.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.insertform.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.removePipe
form.reorderform.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.getFieldsetfield.getFieldset() returns metadata for the child fields of a nested object. Child field names are inferred automatically from the parent field path.
field.getFieldListReturns 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.formIdPipe
field.allValidPipe
field.allErrorsfield.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.requiredPipe
field.minPipe
field.maxPipe
field.minLengthPipe
field.maxLengthPipe
field.patternPipe
field.multiplePipe
field.stepfield.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