# Input

> A single-line text field. Aligns with buttons and selects of the same size.

Category: Inputs · Atomic level: atom · Built on Base UI Input
Page: https://ui.dtheo.dev/docs/components/input

## Install

```bash
npx dtheo@latest add input
# or, with the shadcn CLI
npx shadcn@latest add https://ui.dtheo.dev/r/input.json
```

Dependencies: @base-ui/react, clsx, tailwind-merge. Registry dependencies: utils.

## Exports

`Input`, `fieldControlClass`

## Use it for

- Names, identifiers, search terms, short values

## Reach for something else

- Numbers with units or steppers: use Number field
- Long text: use Textarea

## Accessibility

- Always pair with a visible label (use Field). Placeholder text is not a label.

## Examples

### input-states

```tsx
import { Field, FieldDescription, FieldError, FieldLabel } from '@/components/ui/field';
import { Input } from '@/components/ui/input';

export default function InputStates() {
  return (
    <div className="grid w-full max-w-lg gap-x-4 gap-y-5 sm:grid-cols-2">
      <Field>
        <FieldLabel>Run name</FieldLabel>
        <Input defaultValue="High-gain step" />
      </Field>
      <Field>
        <FieldLabel optional>Tag</FieldLabel>
        <Input placeholder="e.g. retune-kp" />
      </Field>
      <Field>
        <FieldLabel>Firmware</FieldLabel>
        <Input defaultValue="4.18.2" readOnly />
        <FieldDescription>Reported by the controller.</FieldDescription>
      </Field>
      <Field disabled>
        <FieldLabel>Actuator serial</FieldLabel>
        <Input defaultValue="ACT-7731-B" />
        <FieldDescription>Locked while R-0412 is running.</FieldDescription>
      </Field>
      <Field invalid className="sm:col-span-2">
        <FieldLabel>Bench</FieldLabel>
        <Input defaultValue="Bench 9" />
        <FieldError match>There is no Bench 9. Enter a bench from 1 to 6.</FieldError>
      </Field>
    </div>
  );
}
```

## Used in

- Data table pattern (template): https://ui.dtheo.dev/docs/patterns/data-table
- Field (molecule): https://ui.dtheo.dev/docs/components/field
- Input group (molecule): https://ui.dtheo.dev/docs/components/input-group
- Textarea (atom): https://ui.dtheo.dev/docs/components/textarea
- Select (molecule): https://ui.dtheo.dev/docs/components/select
