Skip to content

Input

A text input on Base UI, sized to the 30px control.

With a label

Types

File

Disabled

Invalid

Installation

npx shadcn@latest add @khaeli/input

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Registry items
npm packages
  • @base-ui/react ^1.7.0

Keyboard

Tab
Moves focus to the input. A disabled input leaves the tab order.
ArrowUpArrowDown
On type="number", raise and lower the value by its step.
Escape
On type="search", clears the text in Chromium.
Space
On type="file", opens the browser's file chooser.

Accessible name

  • Every input needs a name. Give it an id and point a @khaeli/label at it with htmlFor.
  • A placeholder is not a name: it goes as soon as something is typed. Use it for an example of the value.
  • Where a visible label would repeat what is beside the input, such as a search box next to a Search button, use aria-label.
  • An invalid control carries aria-invalid and lists the id of its message in aria-describedby, so the message is read as its description. @khaeli/field lays the label, control and message out.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/input.json