Input
Single-line text field and Field (label, description, error). Focus shows through the frame.
import { Input, Field } from "@arcadia/ui"Shown in the sidebar and the window title.
Field wires a label, a description and an error to one Input or Textarea. A field is transparent in a 10% frame (radius 10, 12 at lg), findable on a card as well as on the page. Focus shows through the frame, never a ring: under the pointer it steps to 20%, and focus draws it in the ring's ink (--ring, the 40% every focused control wears) with a 3px halo over 200ms; the caret carries the rest. Placeholders are text-3, so they stay readable. Clicking the frame's padding or its icon focuses the field, as a native one would. Heights are 24, 28 (the default) and 32.
Examples
rootStyle takes where the field sits (margins, self-alignment, flex and grid placement, size bounds) and the knobs below, each a token of its kind. A colour, a raw length or any other property is a type error: a look that comes up twice becomes a variant.
| Knob | Takes | Default | Sets |
|---|---|---|---|
Ref<Control> | var(--control-md) | Height. | |
Ref<Space> | var(--space-2-5) | Inline padding. | |
Ref<Radius> | var(--radius-row) | Corner radius. | |
Paint | transparent | Fill. | |
Paint | var(--text-1) | Text colour. | |
Paint | var(--text-4) | Text colour when disabled. | |
Paint | var(--text-3) | Placeholder colour. | |
Paint | var(--icon-3) | Leading glyph colour. | |
Paint | var(--icon-4) | Leading glyph colour when disabled. | |
Paint | var(--stroke-2) | Frame colour (1px) at rest. | |
Paint | var(--stroke-1) | Frame colour under the pointer. | |
Paint | var(--ring) | Frame colour while the field has focus. | |
Paint | var(--stroke-4) | Frame colour when disabled. | |
Paint | var(--fill-3) | The halo (--halo-width) around a focused frame. |
rootStyle lands on the frame. Each state reads its own knob (--input-border-hover, --input-border-focus, --input-border-disabled). Invalid turns the frame and the halo to the danger colour whatever the knobs say, so an error always reads.
A native <input>. Inside Field, the label's for, aria-describedby (description and error) and aria-invalid are wired for you, and an error always shows. The leadingIcon is decorative and the end slot's controls carry their own labels.
Without a Field, name the input yourself: a <label htmlFor> or aria-label. A placeholder is not a label; it disappears as soon as someone types.
Pass required for a required field and say so in the label text too. An error appears when it is set, so on submit move focus to the first invalid field (or to a summary with role="alert") to have it announced. Give autoComplete a real value (email, name, url) so browsers and password managers can fill it, and off only for search fields.
- Tab
- Moves into and out of the field
- Enter
- Submits the surrounding form
Input
size- "sm" | "md" | "lg"Default"md"
- Height:
sm24px,md28px,lg32px. variant- "default" | "ghost"Default"default"
ghostdrops fill and border (menu search rows, inline rename).end- ReactNode
- Trailing slot: a Spinner, a key hint, a clear IconButton.
invalid- boolean
- Marks the control invalid (aria-invalid); a surrounding
Fieldwitherrordoes it too. mono- boolean
- A machine fact typed as it reads (an invite or one-time code, an API key, a path): the value and its placeholder in mono.
rootStyle- InputStyle
- Typed StyleX override for the
.ui-inputframe: where it sits and its--input-*knobs. onValueChange- (value: string, details: { event: Event }) => void
- Called with the new text on every change (beside
onChange). render- RenderProp
- Replaces the
<input>. Every other prop,refincluded, lands on the input. className- string
- A product's hook class on the frame, for its own layout rules. Being retired: new code places a field with
rootStyle; the call sites left are counted by ui.lint (kit-classname) and only go down. disabled- boolean
- Disables the field; the frame dims.
placeholder- string
- Placeholder at text-4.
Rest props go to <input> props.
label- ReactNode
description- ReactNode
- Help text under the label (text-3, 12/16).
error- ReactNode
- Error message; when present the field is invalid and the message is always shown.
invalid- boolean
disabled- booleanDefaultfalse
- Disables the control and dims the label.
rootStyle- RootStyle
- Typed StyleX override: where the field sits.
className- string
- A product's hook class for its own layout rules. Being retired: new code places a field with
rootStyle; the call sites left are counted by ui.lint (kit-classname) and only go down.
Rest props go to <div> props.