Skip to content

Input

A single-line text input that takes its label and validation from Field.

Shown in the app list and on the published WebApp.

hero.tsx

Usage guidelines

  • Use Input for one line of free text. Multiline text uses Textarea, numbers with steppers use NumberField, secrets use PasswordField, and a prefix, suffix or inline action that shares the input surface uses InputGroup.
  • Put the input in a Field with a FieldLabel. The field owns the label, FieldDescription and FieldError relationships and the name the value submits under.
  • Use aria-label only when the layout has no place for a visible label, such as a search box in a toolbar. A placeholder shows an example value and is never the name.
  • Inputs that save together belong in a real form boundary: Form or a native <form>, with a Button of type="submit". Keep the submit button enabled while the form is incomplete; submitting runs validation.
  • Set the native attributes that describe the value: type, autoComplete, inputMode and spellCheck={false} for URLs, emails and identifiers.
  • Input has a single size. Use disabled for a value the user cannot change now, and readOnly for a value that can be selected and copied but not edited.

Anatomy

tsx
tsx

Examples

States

Set invalid on the Field when application code owns the validity, and render <FieldError match> while it is invalid; editing the URL to include https:// clears the error. disabled on the Field disables the label and the input together. A read-only input keeps its focus ring so keyboard users can reach and copy the value.

Enter a full URL including https://.
states.tsx

Validation in a form

Native constraints such as required and type="url" drive FieldError. Each match value names the validity state its message covers. Submit the empty form to see the messages; after a submit, they update as the value changes.

Receives a POST request when a workflow run finishes.

validation.tsx

Without a visible label

A search box in a toolbar sits next to the title of the list it filters, so it has no room for a label of its own. It takes aria-label instead; the placeholder alone would not name it. The <search> element around it marks the search landmark.

Apps

  • Customer support botChatflow
  • Release notes writerWorkflow
  • Contract reviewerWorkflow
  • SQL query assistantAgent
toolbar-search.tsx

API reference

Input

A standalone single-line text input that integrates with Field. Renders an <input> element.

Use InputGroup with InputGroupInput when the field needs a prefix, suffix, or inline action.

Base UI Input docs

Data attributes
AttributeDescription
data-disabled

Present when the input is disabled.

data-valid

Present when the input is in a valid state (when wrapped in Field.Root).

data-invalid

Present when the input is in an invalid state (when wrapped in Field.Root).

data-touched

Present when the input has been touched (when wrapped in Field.Root).

data-dirty

Present when the input's value has changed (when wrapped in Field.Root).

data-filled

Present when the input is filled (when wrapped in Field.Root).

data-focused

Present when the input is focused (when wrapped in Field.Root).