Skip to main content

Input

Text input field for collecting user information. Supports all HTML input types with built-in accessibility and RTL support.

Preview

Installation

Terminalbash

Usage

Reacttsx

Examples

Input Types

tsx

With Label

tsx

With Icon

tsx

Disabled and Read-only

tsx

With Validation

tsx

Complete Form

tsx

Props

NameTypeDefaultDescription
type
'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | ...'text'HTML input type
placeholder
stringundefinedPlaceholder text shown when input is empty
disabled
booleanfalseDisables the input
readOnly
booleanfalseMakes the input read-only
required
booleanfalseMarks the input as required
className
stringundefinedAdditional CSS classes to apply

The Input component extends all standard HTML input attributes including value, onChange, onBlur, name, and more.

Accessibility

Always Use Labels

Always pair inputs with labels using the htmlFor attribute matching the input's id. This is critical for screen readers and improves usability.

Placeholder Text

Don't rely solely on placeholder text for instructions. Use labels and helper text. Placeholders disappear when typing and may not be read by all screen readers.

Error Messages

Associate error messages with inputs using aria-describedby:

tsx

Required Fields

Use the required attribute and indicate required fields visually (typically with an asterisk).

RTL Considerations

Input fields automatically support RTL text direction. Text alignment and cursor position adapt based on the text direction.

LTR (English)

RTL (العربية)

Related Components