Input
Single-line text, email, password, telephone and URL, plus multi-line text: Base UI's Input (Field.Control) in the field box, inside a Field.
import { Input } from '@fairgarden/design/forms/input'
The box is open by default: a --border-size-1 --role-rule edge that steps to --primary12 on hover, at the same weight. The ring shows on any focus, pointer included. The placeholder is never the label and ends in "…". className and style go to the box. Size it to the expected answer with chars (chars={5} for a five-digit postcode): the value gets room for that many characters, and the box adds its padding and edge on top. Stepped numbers use NumberField, choices use Select or Combobox, and site search is Search.
Variants and states
Variants and states
prefix, suffix and icon adorn the box. labelInside draws the label in the 56 px box, with the value below it, larger. variant="underline" is a lone bottom rule for dense settings rows and printable blanks. multiline is the textarea, with an optional limit count. reveal adds a "Show" / "Hide" toggle to a password. butted="end" joins the action cell: the icon-only 64 × 48 px cell at base, with its label from --md-n-above when labelled. Invalid fields take a --border-size-2 danger edge; read-only fields lose the box and keep a bottom rule; disabled fields draw a dotted edge.
Up to 200 characters.
Primary and secondary
Primary and secondary
primary sets the edge, value, icon and ring. secondary is unused at rest; while the Field is invalid it becomes the danger scale. The action cell takes the scope's action scale.
On grounds
On paper and forest
The same field on paper and forest. plate makes the box a nested white face: use it only on a patterned ground (grain, speckle, dotgrid), where a --role-rule edge may not sit.
paper
forest
API Reference
A text field on Base UI’s Input (Field.Control), inside a Field. The
placeholder is never the label; end it with “…". A plate belongs only on
a patterned ground; everywhere else the box is open.
| Prop | Type | Description |
|---|---|---|
label | | The label drawn inside the box, title case [D160]. Required with |
action | | The butted action cell; one-field forms only. |
butted | | Joins the action cell at the box’s end: --radius-0 at the seam. |
chars | | The expected answer’s length in characters (a 5-digit postcode: |
icon | | A leading icon: Material Symbols Rounded, inline tier (§6.10). |
labelInside | | The |
limit | | |
multiline | |
|
plate | | The box face becomes a nested |
prefix | | A prefix unit inside the box, in --role-muted ("$"). |
primary | | Primary Radix scale: box edge, value, placeholder, icon and focus ring. Never defaulted; omitted, it inherits the scope [D133]. |
reveal | | Password fields: adds a “Show” / “Hide” text toggle, never an eye icon alone (§10.3). |
revealLabels | | The toggle’s two labels. Default |
rows | | |
secondary | | Secondary Radix scale. Unused at rest; while the Field is invalid it is the danger scale (the error edge). |
suffix | | A suffix unit inside the box, in --role-muted (“USD”). Never the unit only in the placeholder. |
variant | |
|
className | | Class names for the box (the root), added after the module’s own. |
style | | Inline style for the box, passed through. Size the box to the expected answer with |
InputAction
The butted action cell (§10.3): a solid Button joined to the box’s end.
type InputAction = {
/**
* The action's accessible name, and its visible `type-button` label from
* `--md-n-above` when `labelled`. Title case, no tracking [D160].
*/
label: string;
/**
* Shows `label` in the cell from `--md-n-above` (with `--size-px-5`
* padding). It stays the icon-only 64 × 48 px cell at base, below
* `--xs-n-below` and below 360 px of Form width. Default `false`.
*/
labelled?: boolean;
/** Busy: the cell is inert and reads `busyLabel`; an icon-only cell shows "…" [D84]. */
busy?: boolean;
/** The "-ing…" wording while busy, e.g. "Sending…". Default "Sending…". */
busyLabel?: string;
/** Default `submit`. */
type?: 'submit' | 'button';
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
disabled?: boolean;
}inputParts
The module’s part classes, for composed components that build a field box around another Base UI control (Search’s Autocomplete input) and leave the box’s parts to this module (§1.11.1).
type inputParts = {
control: string;
icon: string;
affix: string;
actionSlot: string;
actionIcon: string;
actionText: string;
edge: string;
edgeLine: string;
}InputProps
Props for Input: Base UI Input props (for the control) plus the variant,
slot and color props. className and style go to the box.
type InputProps = (
| {
variant?: 'outline';
plate?: boolean;
multiline?: false;
rows?: undefined;
limit?: undefined;
reveal?: boolean;
revealLabels?: [string, string];
labelInside: true;
label: React.ReactNode;
butted: 'end';
action: InputAction;
}
| {
variant?: 'outline';
plate?: boolean;
multiline?: false;
rows?: undefined;
limit?: undefined;
reveal?: boolean;
revealLabels?: [string, string];
labelInside: true;
label: React.ReactNode;
butted?: undefined;
action?: undefined;
}
| {
variant?: 'outline';
plate?: boolean;
multiline?: false;
rows?: undefined;
limit?: undefined;
reveal?: boolean;
revealLabels?: [string, string];
labelInside?: false;
label?: undefined;
butted: 'end';
action: InputAction;
}
| {
variant?: 'outline';
plate?: boolean;
multiline?: false;
rows?: undefined;
limit?: undefined;
reveal?: boolean;
revealLabels?: [string, string];
labelInside?: false;
label?: undefined;
butted?: undefined;
action?: undefined;
}
| {
variant?: 'outline';
plate?: boolean;
multiline: true;
rows?: number;
limit?: number;
reveal?: undefined;
revealLabels?: undefined;
labelInside?: false;
label?: undefined;
butted?: undefined;
action?: undefined;
}
| {
variant: 'underline';
plate?: false;
multiline?: false;
rows?: undefined;
limit?: undefined;
reveal?: boolean;
revealLabels?: [string, string];
labelInside?: false;
label?: undefined;
butted?: undefined;
action?: undefined;
}
| {
variant: 'underline';
plate?: false;
multiline: true;
rows?: number;
limit?: number;
reveal?: undefined;
revealLabels?: undefined;
labelInside?: false;
label?: undefined;
butted?: undefined;
action?: undefined;
}
) & {
/** Class names for the box (the root), added after the module's own. */
className?: string;
/** Inline style for the box, passed through. Size the box to the expected answer with `chars`. */
style?: React.CSSProperties;
/**
* The expected answer's length in characters (a 5-digit postcode: `5`).
* The control is that many characters of its own type wide; the box adds
* its padding, edge and any icon, affix or toggle on top, and never grows
* past its container. Omitted, the box fills its container.
*/
chars?: number;
/**
* Primary Radix scale: box edge, value, placeholder, icon and focus ring.
* Never defaulted; omitted, it inherits the scope [D133].
*/
primary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| null;
/**
* Secondary Radix scale. Unused at rest; while the Field is invalid it is
* the danger scale (the error edge).
*/
secondary?:
| 'ruby'
| 'olive'
| 'sage'
| 'slate'
| 'sand'
| 'gray'
| 'mauve'
| 'brown'
| 'bronze'
| 'gold'
| 'red'
| 'crimson'
| 'tomato'
| 'pink'
| 'plum'
| 'indigo'
| 'iris'
| 'violet'
| 'purple'
| 'amber'
| 'blue'
| 'cyan'
| 'grass'
| 'green'
| 'jade'
| 'lime'
| 'mint'
| 'orange'
| 'sky'
| 'teal'
| 'yellow'
| null;
/** A leading icon: Material Symbols Rounded, inline tier (§6.10). */
icon?:
| 'link'
| 'menu'
| 'search'
| 'circle'
| 'arrow_forward'
| 'arrow_upward'
| 'expand_more'
| 'close'
| 'remove'
| 'add'
| 'check'
| 'chevron_right'
| 'chevron_left'
| 'more_horiz'
| 'more_vert'
| 'play_arrow'
| 'pause'
| 'download'
| 'zoom_in'
| 'zoom_out'
| 'recenter'
| 'help'
| 'mail'
| 'content_copy'
| 'open_in_new'
| 'restart_alt'
| 'description'
| 'widgets'
| 'deployed_code'
| 'format_h2'
| 'format_h3';
/** A prefix unit inside the box, in --role-muted ("$"). */
prefix?: React.ReactNode;
/** A suffix unit inside the box, in --role-muted ("USD"). Never the unit only in the placeholder. */
suffix?: React.ReactNode;
}Specification: DESIGN-SYSTEM.md §10.1 (the field box) and §10.3 (input).