Skip to content

Inputs

Input

A single-line text field with optional prefix and suffix adornments, three sizes that match buttons, and an invalid state. Wrap it in Field to get a label, hint and error message that are wired up for screen readers automatically.

On this page
https://.plinth.app

Letters, numbers and dashes.

That handle is already taken.

Usage

components/ui/input.tsx
import { Field } from "@/components/ui/field";import { Input } from "@/components/ui/input"; export function Example() {  return (    <Field label="Email" hint="We'll send the receipt here.">      <Input type="email" placeholder="ada@fernhill.example" />    </Field>  );}

Examples

Overview

https://.plinth.app

Letters, numbers and dashes.

That handle is already taken.

Sizes

32, 36 and 40px: the same heights as Button, Select and the other fields, so rows line up.

Prefix and suffix

Adornments sit inside the border. Text, icons and small buttons all work; clicking an adornment focuses the input.

⌘K
$USD
days

States

Invalid comes from Field's error (or the invalid prop). Disabled and read-only use the native attributes.

Enter a valid EU VAT number.

Set by your admin.

Read-only, safe to share.

Password with toggle

A suffix button that toggles visibility. Validation runs as you type and swaps the hint for an error.

At least 12 characters.

Props

Input

  • size"sm" | "md" | "lg"default: "md"Height 32 / 36 / 40px.
  • prefixReactNodedefault: —Icon or text inside the border, before the value.
  • suffixReactNodedefault: —Icon, unit, shortcut or small button after the value.
  • invalidbooleandefault: —Red border and aria-invalid. Set automatically by <Field error>.
  • classNamestringdefault: —Classes for the outer box (width, margins).
  • inputClassNamestringdefault: —Classes for the inner <input> (alignment, font).
  • ...propsInputHTMLAttributesdefault: —Any native input attribute: type, value, onChange, placeholder, autoComplete…

Field

  • labelrequiredReactNodedefault: —Visible label, linked to the control.
  • hintReactNodedefault: —Help text under the control (aria-describedby).
  • errorReactNode | booleandefault: —Error message. Replaces the hint and marks the control invalid.
  • requiredbooleandefault: —Adds a red asterisk and the native required attribute.
  • optionalbooleandefault: —Adds a quiet “Optional” tag after the label.
  • disabledbooleandefault: —Disables the control inside.
  • actionReactNodedefault: —Small element at the right of the label row, e.g. a link.
  • htmlForstringdefault: —Id for the control. Generated when omitted.

Accessibility

  • Field renders a real <label for> and gives the control its id, so clicking the label focuses the input and screen readers announce it.
  • The hint or error is linked through aria-describedby; when an error is shown, the input also gets aria-invalid="true".
  • Errors show an icon and text in addition to the red border, so the state never relies on color alone.
  • Without a visible label (search boxes, table filters) pass aria-label on the Input.
  • Adornment buttons (like the password toggle) are real buttons with an aria-label and aria-pressed.

Suggested