Skip to main contentCarbon Design System

Text input

Text inputs enable users to enter free-form text data. You can use them for long and short-form entries.

Overview

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.

Text input and text area example

When to use

  • A user needs to input unique information that cannot be predicted with a preset of options.
  • A user needs to input memorable data that can be entered more quickly in a free-hand format versus a more complex control.

When not to use

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

Variants

VariantPurpose
Text inputWhen the expected user input is a single line of text.
Text areaWhen the expected user input is more than a few words that could span multiple lines.

Live demo

<div>