# Forms ## Basic pattern Nuxt UI forms use `UForm` + `UFormField` + Standard Schema validation (Zod, Valibot, Yup, or Joi). ```vue ``` ## Key rules - Always use `UFormField` around inputs — it connects validation errors via the `name` prop - The `name` prop on `UFormField` must match the schema field name exactly - Use `reactive>({})` for state — `Partial` allows empty initial values - `@submit` only fires when validation passes - For nested objects, use dot notation: `name="address.city"` ## UFormField props | Prop | Purpose | |---|---| | `name` | Links to schema field for validation errors | | `label` | Visible label text | | `description` | Help text below the input | | `hint` | Right-aligned hint text (e.g., "Optional") | | `required` | Shows required indicator | | `size` | Inherits to child input | ## Field layout patterns ### Vertical stack (default) ```vue ``` ### Inline fields with UFieldGroup ```vue ``` ### Grid layout ```vue ``` ## Common field patterns ### Select ```vue ``` ### Checkbox ```vue ``` ### Radio group ```vue ``` ### Switch ```vue ``` ### Textarea ```vue ``` ### File upload ```vue ``` ### Date ```vue ``` ## Programmatic validation ```vue ``` ## Form in a modal Use `#footer="{ close }"` scoped slot for cancel/submit actions. Wrap the modal body in `UForm` with a `type="submit"` button in the footer so validation runs on submit. ```vue ```