Input
A single-line field where users can input and edit text.
Props
default.
1.
left.
text.
goa.
Events
ReactNode
Ask a user for dollar amounts
Disabled button with a required field
Filter data in a table
Limit the width of helper text
Reveal input based on a selection
States
When you must disable a button or input:
- Provide nearby text explaining what needs to happen first
- Consider showing the element enabled with validation on submit instead
- Use aria-describedby to link the disabled element to explanatory text
Other
The form item automatically associates the label with the input for screen readers, ensuring your form is accessible.
Types
Content
Placeholder text disappears when users start typing, leaving them without context for what the field is asking for.
Always use a visible label above or beside the input field. Placeholder text can provide an example of the expected format, but should never be the only indication of what information is needed.
Sizing
Known input length: Use fixed-width inputs for content with a specific length, such as postal code (7 characters) or year (4 characters).
Unknown input length: If you don’t know how many characters the user will need (like their name), make your text input 100% of the container.
Forms
Capture text input from users in forms.
When to use
Use Input when you need users to enter:
- Short text answers (names, email addresses)
- Numbers (phone numbers, quantities)
- Dates and times
- Search queries
When not to use
Don’t use Input when:
- Users need to enter multiple lines of text (use Textarea)
- Users need to select from predefined options (use Dropdown or Radio)
- The input requires complex formatting (consider specialized components)
Types
Input supports multiple HTML input types:
- text - General text entry (default)
- email - Email addresses with validation
- password - Masked password entry
- number - Numeric values with stepper
- date - Date picker
- tel - Phone numbers
- search - Search with clear button
States
- Default - Normal interactive state
- Focused - When the input has keyboard focus
- Error - When validation fails
- Disabled - When input is not available
- Read-only - When showing value without editing