Input
<Input>TailwindCSS ModulesA foundational text field component for forms. Includes built-in support for labels, hints, validation errors, leading icons, trailing tooltips, and password toggles.
npx coloxo add input --style coloxo-cssimport { Input } from '@coloxo/ui';Design Tokens:
1. Variant Matrix
Inputs support various states (default, invalid, disabled) and adornments (icons, leading text, shortcuts).
| Default | With Icon | With Leading Text | Password (Toggle) | |
|---|---|---|---|---|
| States | Basic text input. | https:// | ||
| Validation | Invalid email address | Search query too short | https:// Invalid URL format | Password is too weak |
2. Control heights (Sizes)
Inputs are available in three standard control heights. Font sizes automatically scale down in the 'sm' variant.
Sizes Specification Grid
size="sm"Size (36px)
Dense forms, inline filters
size="md"DEFAULTSize (40px)
Standard forms, settings
size="lg"Size (44px)
Hero search, auth screens
3. Interactive Props Configurator
Leading Icon
Leading Text (Inline)
Help Tooltip
Keyboard Shortcut
Invalid / Error State
Disabled State
This is a hint text to help user.
<Input label="Email" type="email" placeholder="olivia@untitledui.com" defaultValue="olivia@untitledui.com" tooltip="Enter a work email address" hint="This is a hint text to help user."/>4. Dark theme
Inputs adapt their background surfaces, focus rings, and error colors seamlessly in dark mode.
Standard input in dark mode.
Username already taken.
5. Enterprise layout compositions
Inputs are often stacked in authentication forms or placed inline in toolbars.
Sign in to your account
Accessibility
The component automatically wires up `aria-describedby` to link the input field to both its hint text and validation error messages for screen readers.
When the `error` prop is passed, `aria-invalid='true'` is automatically applied to the input element.
Passing a `label` automatically generates a unique ID (if none is provided) and associates the `<label htmlFor>` with the `<input id>`.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| size | "sm" | "md" | "lg" | md | 36 / 40 / 44px height. sm uses 14px text; md/lg use 16px. |
| hint | ReactNode | — | Helper text below the field (alias of description). |
| error | ReactNode | — | Validation message; shows trailing error icon. |
| icon | ReactNode | ComponentType | — | Leading icon. |
| leadingText | string | — | Inline leading text (e.g. https://). |
| tooltip | string | — | Trailing help icon with tooltip. |
| shortcut | string | boolean | — | Trailing shortcut badge (true → ⌘K). |
| type | string | — | Use "password" for show/hide toggle. |