Core components / Inputs
Input
A single line of text. The border warms to orange with a soft halo on focus; icons, a shortcut, a fixed prefix or a joined select can sit inside. InputField adds the label, hint and error on the same size ladder.
Code
The component itself, ready to drop into your project. Switch between React, Vue and plain HTML; every version uses the same Tailwind classes on Ochre's tokens.
Installation
Examples
Input field
Label, hint, error, disabled and optional. Pick a size: the label and hint move with it.
We only use this to send receipts.
Enter an email address like name@example.com.
Set when the workspace was created.
Icons, prefix and joined selects
A shortcut, a fixed prefix, and a select joined on the leading or trailing side.
Sizes
The same ladder as Button, so inputs and buttons line up in a row.
Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "s" | "m" | "l" | "xl" | "xxl" | "m" | 32 to 64 pixels high, matching Button. |
| leadingIcon | ReactNode | – | Icon at the start, in the muted icon colour. |
| trailingIcon | ReactNode | – | Icon or small control at the end. |
| shortcut | ReactNode | – | Keys shown at the end, usually <Kbd> elements. |
| leadingAddon / trailingAddon | ReactNode | – | A flush segment joined to the start or end: fixed text such as "https://", or an <InputAddonSelect>. |
| invalid | boolean | – | Red border and halo. Field sets it for you when it has an error. |
| wrapperClassName | string | – | Classes for the bordered wrapper; className goes on the <input>. |
| InputAddonSelect options | (string | { value; label; short? })[] | – | Choices for a joined select. short is what the closed segment shows, such as +44 for United Kingdom +44. |
| InputAddonSelect value / defaultValue / onValueChange | string, (value) => void | – | Controlled or uncontrolled choice. Give it an aria-label. |
| InputField label / hint / error | ReactNode | – | Label above, one line under: the error replaces the hint and adds the alert icon inside. |
| InputField optional | boolean | – | Adds a mono OPTIONAL tag beside the label. |
Usage
Use it for
- Short free text: names, emails, URLs, amounts, search.
- M on desktop forms, L on sign-in, checkout and mobile.
- A prefix for the part people never type (https://, a domain), a joined select for a protocol or unit.
Avoid
- Placeholder text as the only label: use InputField.
- S inputs on a desktop form: they read as cramped.
- A joined select with more than about eight options: use a separate Select.