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
| Guidance | Practice |
|---|---|
| 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 | Description |
|---|---|---|
size | 'sm' | 'md' | 'lg' | sm, md or lg.Default: 'md' |
variant | InputVariant | default draws the field chrome. ghost keeps the sizing and leaves chrome and focus to the container.Default: `ghost` inside an `InputGroup`, else `default` |
Examples
A labelled input
<Field.Root>
<Field.Label>Email</Field.Label>
<Input type='email' autoComplete='email' />
</Field.Root>