Skip to content

Input

Single-line text field built on the native <input>; supports addons, clearable, and password-toggle affordances.

  • stable
  • since v0.1.0
  • 4.42 kB
  • form
  • input

Renders a native <input>; aria-invalid toggled on invalid state; focus ring follows design tokens.

Renders as a segmented control: the field and any addon slots sit as raised tiles inside a tinted, padded track — the same container NumberInput and the date/time pickers use. The focus ring lights up the track.

Preview
Open
tsx

Three sizes are available: sm, md (default), and lg.

Preview
Open
tsx

Set invalid to signal a validation error visually.

Preview
Open
tsx
Preview
Open
tsx

Use leadingSlot and trailingSlot to attach icons or text prefixes/suffixes.

Preview
Open
tsx

Pair with a visible description below the field.

Preview
Open
tsx
PropTypeDefaultDescription
type
"number"|"text"|"email"|"password"|"tel"|"url"|"search"
"text"
Native `<input type>` value. `password` automatically adds a show/hide toggle; `search`/`email`/`tel`/`url`/`number` keep their native keyboards on mobile.
variant
"outline"|"filled"|"ghost"|"flat"
"outline"
Visual treatment. `outline` is the default bordered surface; `filled` uses a tinted background; `ghost` removes the surface entirely; `flat` is the legacy single-well layout (no multi-well slots).
leadingSlot
ReactNode|ReactNode[]
—
Single node or array. Strings/icons render as inert wells; buttons/onClick render as action wells.
trailingSlot
ReactNode|ReactNode[]
—
Single node or array. Same rules as leadingSlot.
clearable
boolean
—
When true and value is non-empty, appends a clear × as a trailing action well.
className
string
—
style
CSSProperties
—
placeholder
string
—
size
"sm"|"md"|"lg"
"md"
Control size — affects height, padding, and font size.
value
string
—
Controlled value. Pair with `onChange`.
defaultValue
string
—
Uncontrolled initial value.
onChange
((value: string) => void)
—
Called with the next value whenever the user changes the field.
disabled
boolean
—
Disables interaction and dims the field.
name
string
—
Submitted form field name.
readOnly
boolean
—
Renders the field as read-only — value is visible and selectable but not editable.
required
boolean
—
Marks the field as required for form submission.
autoFocus
boolean
—
Focuses the control on mount.
id
string
—
Element id — auto-generated via `useId` when omitted.
invalid
boolean
—
Renders the invalid state (red border, error styling) and sets `aria-invalid`.
  • Renders a native <input> — inherits all built-in ARIA semantics.
  • invalid sets aria-invalid="true" on the underlying input element.
  • Focus ring is token-driven and never removed.
  • Use type="password" to automatically get a show/hide toggle affordance.
  • Use clearable to append an accessible clear button when the field has a value.