Command Palette

Search for a command to run...

Input

Displays a form input field or a component that looks like an input field.

Installation

npm install @radix-ui/react-label

Usage

1 2 3 4 5 import { Input } from "@/components/ui/input" export function InputDemo() { return <Input type="text" placeholder="Email" /> }

Examples

With Label

With Icons

Password Input

Input Sizes

Input States

This field is required.

Props

NameTypeDescription
typestringThe type of the input field.
placeholderstringThe placeholder text for the input.
disabledbooleanWhether the input is disabled.
readOnlybooleanMakes the input read-only.
classNamestringAdditional CSS classes to apply to the input.
...propsInputHTMLAttributesAll standard input HTML attributes are supported.

Accessibility

The input component is built on top of the native HTML input element and supports all of its accessibility features.

  • Always use the Label component with inputs for proper accessibility.
  • Use aria-describedby to associate helper or error text with the input.
  • Use appropriate type attributes for different input types (e.g., email, password).
  • Add aria-invalid="true" to inputs with validation errors.