Text input

The text input allows users to enter a single line of text, providing a customisable version of the native HTML text input

Decorative page cover image showing and example of a text input in use

Best practices

Text inputs enable users to enter free-form text data. The type of text field used should reflect the length of the content you expect the user to enter. The default text input is for short, one-line content, whereas text area is for longer, multi-line entries. Form inputs should always (or almost always) be paired with a label. Search fields is an exception.

When to use

  • A user needs to input unique information that cannot be predicted and represented by any preset of options.
  • A user needs to input a short, single-line piece of information.

When not to use

  • If a user should only enter an option from a predefined list, then avoid using a text input as this is likely to result in an error. Consider using a selection control such as a dropdown, select, or radio button group instead.

Anatomy

Listing all the separate elements of the file uploader
  1. Label: Text that clearly indicate the user about the content they need to enter in the field.
  2. Help icon (optional): Help/info icon for additional help text via a tooltip.
  3. Input requirement (optional): Indicates if the input field is optional or required for the user to complete.
  4. Start icon (optional)
  5. Helper text (optional): Assistive text that can provide additional aid or context to the user. Often used to explain the correct data format or limitations.
  6. Field value: User entered content.
  7. Error message
  8. Placeholder (optional): Optional placeholder text provides hints or examples of what to enter.
  9. End icon (optional)

Behaviour

Placeholder text disappears after the user begins entering data into the input and should not contain crucial information.

Responsive behaviour

All form fields retain properties across screen sizes.