# Input

A single-line text input. Inside a `Field` it takes its id, label, description, disabled, required and invalid state from the field. Inside an `InputGroup` it drops its chrome and takes the group size.

## Use for

- a text, email or search field
- the text part of an `InputGroup`

## Practices

- Do: Render it inside `Field.Root` with a `Field.Label`, so it is labelled and described.
- Do: Use `PasswordInput`, `PhoneInput` or `Otp` for those values.
- Don't: Set `size` inside an `InputGroup`. The group size wins.

## API reference

### Input

Renders an `input` and forwards its ref. When the field keeps a disabled control focusable, the input goes `readOnly` and `aria-disabled` instead of `disabled`.

Slot: `cl-input`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | `sm`, `md` or `lg`. |
| `variant` | `InputVariant` | `` `ghost` inside an `InputGroup`, else `default` `` | `default` draws the field chrome. `ghost` keeps the sizing and leaves chrome and focus to the container. |

## Examples

### A labelled input

```tsx
<Field.Root>
  <Field.Label>Email</Field.Label>
  <Input type='email' autoComplete='email' />
</Field.Root>
```

## Related

- [Field](/docs/components/field.md)
- [InputGroup](/docs/components/input-group.md)
- [PasswordInput](/docs/components/password-input.md)
- [PhoneInput](/docs/components/phone-input.md)
- [Otp](/docs/components/otp.md)
