Input
One line of text a person types: a name, a number, a URL, a search. One component for every text field: an icon or a word before the text, a unit after it, a clear button, a secret's eye and a copy button are props, never a wrapper.
<Input placeholder="billing-sync" /><Input iconStart={MagnifyingGlass} placeholder="Search agents" onClear={clear} /><Input textEnd="seconds" placeholder="300" />Installation
import { Input } from "@catalog-dashboard/components";Usage
import { Field, Input } from "@catalog-dashboard/components";<Field title="Name">
<Input value={name} onChange={(event) => setName(event.target.value)} placeholder="billing-sync" />
</Field>Anatomy
- 1 · Box. The secondary button's fill and edge. The edge is a shadow, never a CSS border. Focus adds a 3px band.
- 2 · Start icon.
iconStart, in the secondary text color. Its side of the box is 2px tighter. - 3 · Start word.
textStart, 12px medium, in the secondary text color. - 4 · Text. The value, or the placeholder in the muted color. Text that runs past the end fades out before what follows it, until the field is focused.
- 5 · End word.
textEnd: a unit. - 6 · Buttons. Clear, the eye and copy, in that order. Gray links with no box of their own, a notch smaller than the start icon (the same size at xs).
| Size | Height | Text | Corner | Side | Start icon | Button icon |
|---|---|---|---|---|---|---|
lg | 36px | 13px | 8px | 12px | 16px | 14px |
md | 32px | 13px | 8px | 12px | 14px | 12px |
sm | 28px | 13px | 8px | 10px | 14px | 12px |
xs | 24px | 12px | 6px | 8px | 12px | 12px |
xxs | 20px | 12px | 5px | 6px | 10px | 8px |
Sizes
Five heights: lg 36px, then the Button's scale, md 32px (the default), sm 28px, xs 24px and xxs 20px. An input is as tall as the button beside it. The text is 13px down to sm and 12px at xs and xxs. In a card's header or footer an input is 28px at most, whatever it asks for.
<Input size="lg" placeholder="lg" /><Input size="md" placeholder="md" /><Input size="sm" placeholder="sm" /><Input size="xs" placeholder="xs" /><Input size="xxs" placeholder="xxs" />Start icon
iconStart says what kind of field this is before a word is read: a magnifier for a search, a globe for a URL. It is decoration, hidden from screen readers; the field still needs its name.
<Input iconStart={MagnifyingGlass} placeholder="Search agents" aria-label="Search agents" /><Input iconStart={Globe} placeholder="https://" aria-label="Issuer URL" />A word before or after
textStart puts a word inside the box before the text; textEnd puts one after it, most often a unit. The word is not part of the value: the field holds 300, the box says seconds.
<Input textEnd="seconds" placeholder="300" aria-label="Timeout" /><Input textStart="Priority" placeholder="10" aria-label="Priority" /><Input textStart="https://" textEnd=".example.com" placeholder="team" aria-label="Subdomain" />Clear button
With onClear, an X shows while value is not empty (a controlled input), and calls you to empty it. The X is a gray link named "Clear". clearButton takes the Button's own props when the default is not enough: a label, another variant, a tooltip.
<Input iconStart={MagnifyingGlass} value={query} onChange={(e) => setQuery(e.target.value)} onClear={() => setQuery("")} /><Input value={query} onChange={(e) => setQuery(e.target.value)} onClear={() => setQuery("")} clearButton={{ emphasis: "low", iconStart: undefined, children: "Clear" }} />A secret
revealable hides the value and adds an eye that shows it. The eye is a toggle named from valueName: here "Show signing secret", pressed while the value is shown. Without valueName it is "Show value".
<Input revealable valueName="signing secret" value={secret} onChange={(e) => setSecret(e.target.value)} />A value to copy
copyable adds a copy button that turns into a check for two seconds. A value shown to be copied is readOnly: the muted fill, the text as it is, and it can still be selected, focused and copied. The copy button works on a disabled field too.
<Input readOnly copyable valueName="gateway URL" value="https://gw.example.com/mcp" />States
Empty with a placeholder, filled, invalid (aria-invalid: a 1px red edge), read-only and disabled. Read-only and disabled share one muted fill; disabled also mutes the text and the edge. Focus adds a 3px band and a 1px line round the edge; on an invalid field they are drawn in the error colors. Click or Tab into one to see it.
<Input placeholder="Placeholder" /><Input value="billing-sync" /><Input aria-invalid value="billing sync" /><Input readOnly value="billing-sync" /><Input disabled value="billing-sync" />In a Field
The Input draws the box and nothing around it. Its title, description and error are the Field's: inside one, the title names the input, the description and the error are read with it, and an error marks it invalid, with no id or aria-* written by hand.
How long one run may take.
<Field title="Timeout" description="How long one run may take." error="Enter a number from 30 to 3600."> <Input textEnd="seconds" value="12" /></Field>Types
Every prop of an <input> passes through, type, inputMode and autoComplete among them.
<Input type="email" autoComplete="email" placeholder="you@example.com" /><Input inputMode="numeric" textEnd="turns" placeholder="20" /><Input type="file" />Numbers
In a number field (type="number", or inputMode "numeric" or "decimal") ↑ and ↓ move the value by one step (1 unless set), and Shift+↑ and Shift+↓ by ten. It stops at min and max, never past. A value typed by hand keeps its decimals: 0.5 goes to 1.5.
<Input inputMode="decimal" textEnd="%" min={0} max={100} defaultValue="50" />Keyboard and screen readers
Its name. An input has no label of its own. Inside a Field the title names it. Anywhere else (a search box in a toolbar) give it an aria-label. A placeholder disappears once a letter is typed.
Tab order. Tab reaches the text first, then each button in the box in the order it is drawn: clear, the eye, copy. A press on the icon, a word or the padding puts the caret in the text, as in a plain input.
The buttons. Each is a real button with a name: "Clear", "Show value" (a toggle, pressed while the value is shown) and "Copy", which reads "Copied" for two seconds. valueName="token" makes them "Show token" and "Copy token". The start icon and the words are not read as controls.
Numbers. In a number field ↑ and ↓ move the value by one step and Shift+↑ and Shift+↓ by ten, inside min and max. The caret stays where it was and the page does not scroll.
Invalid. aria-invalid draws the red edge and tells a screen reader the value is wrong. It does not say why: the Field's error does, and sets aria-invalid for you.
Read-only and disabled. A read-only input stays in the tab order and can be selected and copied. A disabled one is skipped by Tab and is not sent with a form.
API Reference
Input
Besides these, every prop of an <input> (value, onChange, placeholder, type, disabled, readOnly, aria-invalid…) and Base UI's onValueChange. With an icon, a word, onClear, revealable or copyable it draws the box around the input, and className goes to the box; otherwise it renders the input alone. The dashboard's own components/ui/input.tsx renders this input.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "lg" | "md" | "sm" | "xs" | "xxs" | "md" | 36, 32, 28, 24 or 20px tall. In a card's header or footer, 28px at most. |
iconStart | IconComponent | — | An icon before the text, drawn at the size's icon size (16px at lg, 14 at md and sm, 12 at xs, 10 at xxs). |
textStart | string | — | A word before the text, inside the box. |
textEnd | string | — | A word after the text, inside the box: a unit. |
onClear | () => void | — | Shows the clear button while value is not empty (a controlled input). Empty the value in it. |
clearButton | Partial<Omit<ButtonProps, "loadingPlacement">> | — | The clear button's own props over its default (a gray link, the X, named "Clear"). Its icon keeps the size the input gives it. |
revealable | boolean | false | For a secret: hides the value and adds an eye that shows it. |
copyable | boolean | false | Adds a button that copies the value. It works on a disabled field. With an empty value it is disabled. |
valueName | string | — | What the value is called in the eye's and the copy button's names: "token" makes "Show token" and "Copy token". |
Rules
Decided
In a form, its title is the Field's
Decided with the form controls: no label is laid over a control by hand. A label over an input is the Field's title, and a press on it focuses the input.
The unit goes in the box
Decided with the form controls (Settings, Config): a number with a unit takes textEnd, and the title stays the setting's name.
A secret shown once is read-only, with a copy button
Decided with the form controls: an API key after it is created, an agent key, a gateway URL, an enrollment token and a signing secret are a read-only input with the muted fill and a copy button.
Props, not a wrapper
An icon, a word, a unit, a clear button, an eye and a copy button are the Input's own props. With any of them the Input draws the box itself.
The Button's heights
The Input and the Button share one scale. md (32px) is the default, and in a card's header or footer a control is 28px at most.
The error is the Field's
A field's problem is shown inline under the field, not in a banner. Give the Field an error: it marks the input invalid and puts the reason under it.
Open questions
Each of these is something another system advises or builds. None is decided for us.
What does a placeholder hold, and where?
OpenMany inputs show one. No rule says what it should hold, or which fields get one.
They disagree. Atlassian uses none outside a search field. Primer: only as an example of the expected input. Polaris's docs call it a short, non-essential hint that must not carry anything important.
An input with no visible title?
OpenSearch boxes in toolbars have an aria-label and no title today. Nothing says which inputs may go without one.
Atlassian and Primer: every field has a visible label. Primer hides one only where equivalent visible text already names the field.
Does a short answer get a short input?
OpenAn input fills its column: a port number and a URL are the same width, set by the form.
Primer: match the input's width to the expected length of the value. Atlassian: the field's length reflects its content, on a scale of fixed widths.
Which buttons may live in the box?
OpenThree are built in: clear, the eye and copy. clearButton takes any of the Button's props.
shadcn's input group takes several buttons. Primer takes one action that affects the input; Polaris one button in an accessory slot. Atlassian advises against anything pressable inside a text field, for focus reasons.
Read-only or disabled, for a value that cannot be changed?
OpenDecided only for a secret shown once (read-only, above). Nothing says when an input is disabled instead, or what explains it.
Polaris (its web components): a read-only field stays focusable and is read out by a screen reader.
A loading state, and a monospace one?
OpenNeither is a prop.
Primer has both: a spinner that takes a visual's place so nothing shifts, and a monospace option. Atlassian has the monospace one.
Other systems
Read for this page: shadcn's Input and Input Group pages; Base UI's Input and Field pages; Atlassian's Text field (usage, examples and code) and Form pages; GitHub Primer's Text input page, its guidelines and accessibility pages, its forms pattern, and the text input guidelines file in the primer/design repository; and Shopify Polaris's text field, in its web components docs on shopify.dev (the React pages now redirect there) and in the Polaris repository's docs. What the open questions above cover is left out. None of the pages read has a copy button built in; ours has.
| They expose | Ours | Why |
|---|---|---|
| An icon at the end of the box (Primer) | Ask | Not built: the end of ours holds the unit and the buttons. Primer advises against an icon at both ends. |
| A character limit with a count (Primer, Atlassian) | Ask | Not built. The native maxLength passes through. |
| A success state (Primer; Atlassian, as a message in its Form) | Ask | Not built: ours has an invalid state only. |
| A quieter look with no edge (Atlassian) | Ask | Not built: ours has one look. |
| A keyboard hint in the box (shadcn, in its input group) | Ask | Not built. |
| One component per kind of value (Polaris: email, URL, password, search; Base UI: a number field, a one-time code) | Ask | Email, URL and password are type and revealable on the one Input. A number field with steppers and a one-time code are not built. |