# Forms ## Form Components | Component | Purpose | Key Props | Version | | ---------------- | ------------------- | --------------------------------------------- | ------- | | `UInput` | Text input | `type`, `placeholder`, `icon`, `loading` | | | `UTextarea` | Multi-line text | `rows`, `autoresize`, `maxrows` | | | `USelect` | Native select | `options`, `placeholder` | | | `USelectMenu` | Custom select | `options`, `searchable`, `multiple` | | | `UInputMenu` | Autocomplete | `options`, `searchable` | | | `UCheckbox` | Single checkbox | `label`, `description` | | | `UCheckboxGroup` | Multiple checkboxes | `items`, `orientation` | | | `URadioGroup` | Radio options | `items`, `orientation` | | | `USwitch` | Toggle switch | `label`, `description`, `on-icon`, `off-icon` | | | `USlider` | Range slider | `min`, `max`, `step` | | | `UPinInput` | Code/OTP input | `length`, `type`, `mask` | | | `UInputNumber` | Number input | `min`, `max`, `step`, `format-options` | | | `UInputDate` | Date picker | `mode`, `range`, `locale` | v4.2+ | | `UInputTime` | Time picker | `hour-cycle`, `minute-step` | v4.2+ | | `UInputTags` | Tag input | `max`, `placeholder` | | | `UColorPicker` | Color selection | `format`, `swatches` | | | `UFileUpload` | File upload | `accept`, `multiple`, `max-files` | | ## Basic Input Examples ```vue ``` ## SelectMenu (Custom Dropdown) ```vue ``` ### SelectMenu/InputMenu Props (v4.4+) ```vue :viewport-ref="ref" /> ``` ## Checkbox & Radio ```vue ``` ## Form Validation Uses Standard Schema (Zod, Valibot, Yup, Joi, etc.) ### With Zod ```vue ``` ### With Valibot ```vue ``` ## UFormField Props ```vue label="Email" description="Your email" hint="Optional" required :help="error?.message" > ``` ## UFieldGroup (Group Fields) ```vue ``` ## Input States ```vue ``` ## File Upload ```vue ``` **Note (v4.4):** FileUpload now emits `null` when clearing files (previously emitted empty array). ## Date & Time Pickers (v4.2+) ### Date Picker ```vue ``` ### Time Picker ```vue ``` ## Common Patterns ### Login Form ```vue Sign in ``` ### Settings Form ```vue Save ``` ## Best Practices | Do | Don't | | --------------------------------- | -------------------------- | | Use UForm + UFormField | Build custom form wrappers | | Use Standard Schema (Zod/Valibot) | Write custom validation | | Use v-model on form inputs | Manually sync form state | | Use `required` prop for asterisks | Add asterisks manually | | Use `description` for help text | Use separate help elements |