<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Text Input

Input field for entering alpha-numerical information.

Use Text Input...

  • To input or edit freeform alpha-numerical information.
  • To input a single line of text.

Don't use Text Input...

The preview has been updated.

Type

Use an input type that is appropriate for the Text Input's function (e.g., type="email" for an email address field).

The preview has been updated.

Placeholder

Use placeholder to provide hints for what to enter.

Size

Mini

Use size="mini" to reduce the height of a Text Input.

The preview has been updated.

Disabled

Use disabled to prevent a user from entering text. Only use the disabled state; when the text input is part of a read-only form and its information cannot be changed.

When Text Input is part of a Form, use helper text to explain why it is not editable. Otherwise, use a clear label to explain it.

The preview has been updated.

With floating label

An alternate way to display the TextInput with the label positioned inside it, above the selection. To achieve that, use the InputWithFloatingLabel component.

The preview has been updated.

With Button beside

Use TextInputWithButtonBeside to group a text input and button together.

The preview has been updated.

With icon-only Button inset

Use TextInputWithButtonInset to place an icon-only Button within the Text Input. You can also position the enclosed button either "left" or "right" by using the prop buttonPosition.

The preview has been updated.

Labels, Errors, and Helper Text

Refer to Form guidelines.

Managing State in React

Refer to Form guidelines.

Accessibility

Refer to the accessibility guidelines for Form.

Implementation

  • Inputs default to a width of 100%, filling up their container; this is a best practice for responsive design.
  • To limit an input's width, you should constrain its container, e.g., by putting it into a Grid element of a certain number of columns.

Content

Do


Where possible, assist the user with placeholder text to provide examples of what to enter.

Dont


Use ellipsed text, as it will lead to incomplete information.

Do


Keep label text succinct.

Props

TextInput
See core props for additional props that can be applied to this component.
proptyperequireddefaultdeprecation notes
skin
The visual variant. Note that error is implied if the TextInput is used inside of a FormInput that also contains a FormError.
"standard""error"null
false
standard
⚠️ Deprecated
size
The size variation @deprecated This is deprecated without a replacement.
"standard""mini"null
false
standard
This is deprecated without a replacement.
htmlSize
The width of the input, as defined by the number of characters it can display at once. This corresponds to the HTML `size` attribute.
number
false
null
TextInputWithButtonInset
See core props for additional props that can be applied to this component.
proptyperequireddefault
buttonPosition
Position of the button.
"left""right"null
false
right

Related