Input
A single-line text field.
Installation
npx shadcn@latest add https://qure-ui.qure.ai/r/input.jsonUsage
import { Input } from '@/components/ui/input'<Label htmlFor="accession">Accession number</Label>
<Input id="accession" placeholder="ACC-000000" />One line of typed text. For anything longer than a line use a Textarea; for a value chosen
from a known set use a Select or a Radio Group, because a free-text field that only accepts nine
answers is a spelling test.
Size
Heights 32, 40 and 48, matching the Figma field scale. md is the default and pairs with a md
Button on the same row. sm is for dense furniture — a filter bar above a worklist, a cell being
edited in place — and lg for a single field that is the point of the screen, such as a
patient lookup. Do not mix sizes within one form.
With a label and a hint
Six digits, as printed on the requisition.
The full row: a Label bound by htmlFor, the field, and a hint tied on with
aria-describedby. The hint is announced after the label, so it reads as one sentence — keep it
to the format or the constraint, not a second label.
With a leading icon
The component has no icon slot, and does not need one: position the icon absolutely and pad the
field past it. Give the icon aria-hidden and pointer-events-none so it neither speaks nor
swallows the click that should focus the field. A search field with a magnifier is the one place
aria-label alone is defensible; everything else wants a visible label.
Read-only, invalid and disabled
Accession numbers are six digits.
Three different statements, often confused:
| State | Means | Focusable |
|---|---|---|
readOnly | This value is real but yours to copy, not to change | Yes |
data-invalid | What is in here will not be accepted | Yes |
disabled | This field is not available yet, or not to you | No |
An MRN pulled from the RIS is read-only, not disabled — a radiologist copying it into another system should not have to retype it.
Validation
Base UI sets data-invalid when the field fails its Field validation, and the stylesheet
recolours the border and focus ring from it. You do not set a state prop; inside a Field you do
not set the attribute either. The example above sets it by hand only because it is a static
demo, and pairs it with aria-invalid and a described-by message — the colour alone says nothing
to anyone who cannot see it.
A placeholder is not a label. It disappears exactly when someone needs it, and screen readers
announce it inconsistently. Use a real <label>, and keep the placeholder for format hints
like ACC-000000.
size is ours, not the native attribute. The native size counts characters and is shadowed
here on purpose — column widths belong to the layout, not to the input.
API Reference
Everything Base UI's Input accepts — including
value/onValueChange, defaultValue, readOnly, required and the native input attributes —
plus:
Prop
Type