Overview
The Input is an interactive field that allows users to enter text and data.
When you’re using the Input component, make sure it’s labeled clearly to show users what kind of information they should enter. This helps users understand why they’re entering the information and makes the whole experience better.
When to use
Use the Input component to collect user data, such as strings, numbers applicable in various contexts, and other values like emails and passwords.
When not to use
It is not recommended to use the Input component for selecting from a specific set of options. Instead, opt for the Select component..
Anatomy
- Input
- Placeholder / Value
Variants & States
State
The Input states are named after their css pseudo-class.
The Input component goes through various states as the user interacts with it. These states include:
- default: Placeholder displayed instead of content
- hover: Active state when the user hovers over the input
- filled: Displayed after the user enters content and moves on
- typing: Indicates when the user is actively typing
- hasError: Highlights input content as invalid based on validation rules
- disabled: Prevents user interaction
Icon
The Input can has two optional icon positions in the component
- iconStart: An icon placed at the start of the input field, such as a search icon for example
- iconEnd: An icon placed at the end (right) of the input field, such as a password visibility toggle icon
Text Area
If the text exceeds a single line, use the isTextArea variant to enable multiple lines of text within a fixed-height text input.
Internationalization
For RTL (right-to-left) languages, there are no custom adjustments made.
Properties
| Name | Type | Values | Description |
|---|---|---|---|
| type | textpasswordemail number |
Controls the type of information being inserted | |
| disabled | Boolean | truefalse |
Sets the field as to appear disabled, users will not be able to interact with the text field |
| isTextArea | Boolean | truefalse |
Determines if the input is a textArea |
| required | Boolean | truefalse |
Indicates whether the input is required |
| placeholder | String | Text displayed in the text box before a user enters a value | |
| iconStart | icon Block | Icon displayed at the start of the input | |
| iconEnd | icon Block | Icon displayed at the end of the input |
Usage Guidelines
Content Guidelines
We use input to help the user correctly identify the type of the field. Errors may appear when failing to comply with the format.
Keep in mind that hints written into placeholders will disappear as the user types their answer, so more complex instructions work better with hints written on top of the field.
Voice and tone
- We aim to be as neutral as possible.
- Value errors should still feel polite, not demanding.
Copy
Hint
We write hints either in the form of a suggestion or an example.
Error
We clearly communicate the issue and suggest how to fix it.
We make errors dynamic if possible.
Accessibility
- If there’s a possibility of errors, make sure that they are read automatically and as soon as they appear on the screen.
- Make sure that visual directions translate to the audio dimension equally. If not, add alt texts to clarify.