Input

A sunken text field, with icons, text, or buttons over its edges; aria-invalid rings it red.

Installation

Examples

Default

An Input is as tall as a Button of the same size, so the two sit in a row. Wrap it in a Field to give it a label.

demo.tsx

Sizes

default and lg, as tall as a Button of each size.

sizes.tsx

Invalid

aria-invalid rings it red. A Field with an error sets it for you.

invalid.tsx

File

type="file" styles the picker's button as a control, 3px inside the field.

file.tsx

With addons

An InputGroupAddon puts an icon, a short text, or an icon button over the Input's start or end, centered in a column at least as wide as a default control. Text and icons let the pointer through to the field. The Input pads itself clear of it by a control's width, pl-(--spacing-control) for an icon, so a theme that scales controls moves both; longer text takes more.

addons.tsx
https://
kg

An icon button at icon-sm takes the pointer, in a square as tall as the Input, so it sits as far from the edge as from the top and bottom.

password.tsx

With a copy button

A read-only link at lg holds a CopyButton at icon-sm in an addon, 4px from each edge.

copy.tsx

Anatomy

Each part's data-slot, which a theme styles, is beside it.