This page as markdown: /input.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

Input

Status: stable

Styled native text input. Soft-square (rounded-sm), the theme's field surface (outlined or filled), 2px focus ring; aria-invalid raises the destructive error treatment.

Keywords: input, text input, field, form, email, search, file, invalid, validation

Usage

Use Input for short freeform text, search, email, password, file, and native input types. In forms, wrap Input in Field so label, description, required state, and validation messaging stay accessible and consistent.

Best practices

Anatomy

Part Required Description
Input yes The native input element with Sable surface, disabled, focus, and invalid styling.
Label yes Usually provided by Field or a separate Label. It gives the input its visible purpose.
Description no Optional helper copy connected through aria-describedby when using Field.
Error no Validation message paired with aria-invalid and destructive styling.

Props

Name Type Default Description
size "md" | "sm" | "xs" "md" md is the form field. sm is the toolbar field, one rung down (--control-sm), so a filter row with an sm Select, sm buttons and an Input is one height. xs is the dense inset field of a tool panel (an inset panel-field fill, no outline, tight padding) — the same ladder as Select and Combobox. Use it instead of overriding the height with className.
type string "text" Native input type (text, email, password, search, number, file, …). type="file" themes the native selector button via file: token utilities.
disabled boolean false Dims the control and blocks pointer interaction.
aria-invalid boolean — Surfaces the destructive border + ring. Base UI form fields set this automatically.
...props ComponentPropsWithRef<"input"> — All native input attributes (placeholder, value, onChange, ref, …) pass through.

Variants

Tokens used

field-border, field, foreground, muted-foreground, ring, destructive

Accessibility

Related

Examples

Default

import { Input } from "@sableui/react"

<Input placeholder="Search posts" />

With a label

import { Field, Input } from "@sableui/react"

<Field label="Email"><Input type="email" placeholder="you@example.com" /></Field>

Field with helper text

import { Field, Input } from "@sableui/react"

<Field label="Display name" description="Shown on your public profile."><Input placeholder="Nova Reed" /></Field>

Field error

import { Field, Input } from "@sableui/react"

<Field label="Email" error="Enter a valid email address."><Input type="email" defaultValue="not-an-email" /></Field>

Search input

import { Field, Input } from "@sableui/react"

<Field label="Search posts"><Input type="search" placeholder="Search by title, creator, or tag" /></Field>

Invalid

import { Input } from "@sableui/react"

<Input aria-invalid defaultValue="not-an-email" />

File

import { Input } from "@sableui/react"

<Input type="file" accept="image/*" />

Disabled

import { Input } from "@sableui/react"

<Input disabled placeholder="Disabled" />