✦ Asteria UI
Components

Input

Text input field for forms and data entry, with leading/trailing icon slots and an error state.

Installation

npx asteria-ui add input

Usage

import { Input } from "@/components/ui/input";

<Input placeholder="you@example.com" />

Input renders as a bordered wrapper around a plain <input> (so icon slots can sit inside the same border). Pair it with Field for a label, helper text, and error message wired up with the right ARIA attributes — Input itself is deliberately just the control.

Examples

Sizes

With icons

States

API reference

PropTypeDefaultDescription
size"sm" | "md" | "lg" | "xl""md"Density — 32 / 40 / 48 / 56px wrapper height.
errorbooleanMarks the input invalid — sets aria-invalid and the error border color.
leadingIconReactNodeInstance-swap icon slot before the text, auto-sized to match `size`.
trailingIconReactNodeInstance-swap icon slot after the text, auto-sized to match `size`.
wrapperRefRef<HTMLDivElement>Ref to the bordered wrapper, if you need it separately from the input itself.

Accessibility

Accessibility

  • Role. Native <input>, so role="textbox" is implicit.

  • Label. Input has no label of its own — it requires an associated label via Field.

  • Error. The error prop sets aria-invalid="true" on the real input, which drives the error border via CSS :has() on the wrapper.

  • Focus. The wrapper shows the glow-focus ring on focus-within, so focusing the inner input rings the whole bordered box, not just the text.