# Form

> Accessible form fields with labels, descriptions, and validation messages.

_Updated: 2026-06-04_

Accessible form fields with labels, descriptions, and validation messages.

## Installation

```bash
railbase ui add form
```

> [!NOTE]
> `railbase ui add` also copies the `label` component and shared primitives — they ship alongside this component automatically.

## Usage

```tsx
import { Form, FormField, FormItem, FormLabel, FormControl, FormDescription, FormMessage } from "@/lib/ui/form";

<Form>
  <FormField name="email">
    <FormItem>
      <FormLabel>Email</FormLabel>
      <FormControl><Input type="email" /></FormControl>
      <FormDescription>We'll never share it.</FormDescription>
      <FormMessage />
    </FormItem>
  </FormField>
</Form>
```

## Anatomy

Exported parts: `Form` · `FormField` · `useFormField` · `FormItem` · `FormLabel` · `FormControl` · `FormDescription` · `FormMessage`
