Validation
Schema Rules
Validate the whole form with one Zod schema. Errors appear on the matching fields, including fields inside field array rows, and rules across fields become form errors.
What this shows
useForm({ schema })takes any Standard Schema: Zod, Valibot, ArkType, Effect Schema, or Yup 1.7 and newer. There's no adapter to install. See Schema validation.- Each issue goes to the field at its path.
travelers[1].agelands on the age field of the second traveler row, andcontact.emailon the email field. - An issue for the list itself ("Add at least one traveler") becomes the field array's
error. Remove every traveler to see it. - The
.refinerule has no path, so it becomes a form error. The form shows it fromformState.formErrors. - The schema runs again as values change, so errors clear as soon as you fix them. As with any error, a field shows its error once it's touched.
The TextField and NumberField components come from the shared example components.