A text input is a type of form input that gathers plain text information from users. Every text input component must have a label and an input field. Optional placeholder and caption elements can also be added. These will provide the user with examples and more information about how to fill in the field.
Keep a margin of 16px between the text input and any components above or below it. Text inputs will fill 100% width of the parent container when standing alone. When inline with another component, they will fill 50% width. Keep a 16px margin between the text input and any inline components.
In addition to the default state, both types of text inputs have hover, focus, change and blur states. Optional success and loading states are also available. The error state takes the form of an Input Error component.
Labels should prompt the user to enter the necessary information using as few words as possible. Maximum length is one line of text at 310px width. If the label is a full sentence, use sentence case with no end punctuation, unless the label is a question. Otherwise use title case with no end punctuation.
Placeholders should give the user an example or show the required format of the input. Never use a placeholder instead of a label, as the user will lose the prompt once they begin typing. Use sentence case with no end punctuation, unless otherwise dictated by the input format.
Captions provide the user with more information than can fit in the label, including tips and notes. Write in full sentences and stay focused on the overall prompt. Use sentence case with end punctuation.
The text input component is used in the following patterns, which each have additional guidelines: