Skip to content
Change the site theme


An Input is a form element that lets users enter one of various types of text on a single line.


Guidelines page anchor

About Input

About Input page anchor

Use an input when you want to allow a user to enter a single line of text. By default, text inputs allow users to enter any type of text (letters, numbers, and symbols). You can set the input to more specific types if needed. It is used with the Label and Help Text components.

  • Include a visible label on all form fields.
  • Each label must use the htmlFor prop that equals the id of the associated input.
  • Don't use placeholder text as a replacement for labels. It can be used to provide an example to users, but will disappear from the field when a user enters text. It's also not broadly supported by assistive technologies and won't display in older browsers.
  • Use one of 3 ways to label a form field:
    • Visible label with Label (preferred)
    • Visible label that's associated to the input with aria-labelledby
    • Label directly using aria-label
  • Provide clear identification of required fields in the label or at the start of a form. If you use the required field indicator, include the form key at the start of the form.
    • Use the required prop to programatically indicate they are required to browsers.
  • Include inline error text with the error icon on any field that errors to make it visually clear that the field changed.
  • If the input has associated help text or error text, include the aria-describedby prop on the input. This should match the id of the help or error text.

The input component should include the base input, along with supporting elements to compose an input field that gives users the context they need to successfully fill it out.

  • Label — A label should be included for every form field and provide a short title for its associated input.
  • Required field indicator — In a form where there are fewer or as many required fields as optional, use a required indicator to show users which fields are required to be filled out.
  • Help text — Text that's placed below the field to help users prevent an error and describe what makes the form field successful.
Information icon

Accessibility insight

Make sure to connect the Label to the Input. This is done with the htmlFor prop on the label, and the id prop on the input. Those two need to match.

If the input has any associated help text, the input should also use the aria-describedby prop that equals the id of the help text. This ensures screen readers know the help text ties directly to the input.

Input with add-ons (prefix/suffix text or icons)

Input with add-ons (prefix/suffix text or icons) page anchor
  • Prefix/suffix text — Text that can be used as a prefix and/or suffix to the value that is entered. Use prefix/suffix to help users format text.
  • Icon — Icons can be placed in the same area as the prefix and suffix text. Icons should trigger an action (e.g., clearing a field) or in rare cases, provide further context to what value should be entered to make a field's purpose more immediately visible (e.g., a search icon).

How an input functions varies depending on the value of its type attribute. If a type attribute is not specified, the default type is text. The following type options are available:


text page anchor

A single-line text input.

An input for editing an email address. This looks like a text-type input but has validation parameters and relevant keyboard in browsers and devices with dynamic keyboards.

An input that is not displayed but whose value is submitted to the server.

An input for entering a number. It displays a numeric keypad in some devices with dynamic keypads.

Note: We do not support the native HTML input[type="number"] element due to some accessibility concerns. These are best described in the following research article from the digital team(link takes you to an external page).

An input whose value is obscured. This input alerts a user if the site isn't secure.

An input that can't be edited but can receive focus. Allows users to highlight the text in the field.

An input for entering search strings. It may include an icon in supporting browsers that can be used to clear the field. It displays a search key instead of enter key on some devices with dynamic keypads.

An input for entering a telephone number. It displays a telephone keypad in some devices with dynamic keypads.

Change a form field to its error state and add an inline error if the value entered doesn't pass validation requirements.

An inline error is placed below the field to inform a user of any errors in their value. If HelpText is already on a form field, change it to variant=“error” and add error copy before the original help text copy.

Use a disabled form field to show users that they can't interact with the field.

If you want to show information that can't be edited, use a read-only form field or consider another way of showing static information.

Use a read-only form field when a field's value can't be changed, but users should be able to read or apply focus on the field. For example, use a read-only form field if a user needs to copy the value.

An input field must have at least a label and an input.

Stack form fields vertically with $space-80 spacing between each field.

Avoid placing multiple form fields on the same horizontal row to help make it easier to scan a page vertically. Use the Grid component if you need to place form fields horizontally.

Labels should clearly describe the value being requested. They should be concise and descriptive, not instructional. To do this:

  • Use help text to provide instruction if needed. For example, don't use "Enter the registration code on the back of your SIM card below" as label text. Instead, use "SIM registration code" as a label and "Find the registration code on the back of your SIM card" as help text.
  • Avoid articles ("a", "the") and punctuation. For example, use "SIM registration code" rather than "The SIM registration code".

To support internationalization, avoid starting a sentence with the label and using the field to finish it since sentence structures vary across languages. For example, use "Call log expiration date" or "How long should logs be stored?". Don't use "Remove logs after:".

Give users enough information in help text to prevent input and formatting errors. Keep it concise and scoped to information that will help with validation. For example, use help text if a password field has specific requirements that a user should know prior to filling it out.

Required field indicator

Required field indicator page anchor

Use required indicators to show users which fields they must fill out.

Validate form fields on form submission.

Validating a form field when the user leaves the current field (on blur) can be helpful to check for syntax errors. However, this can be frustrating to users who tab through controls to navigate a page, and to screen reader users, who might not be able to detect that an error occurred on blur.

Don't prevent form submission by disabling the submit button. An error message can give more information than a disabled button can to help users figure out which fields are invalid.

Use inline error text to explain how to fix an error.

Ideally, help text should have enough information to help users prevent errors. If HelpText is already on a form field, change it to variant=“error” and add error copy before the original help text copy.

Error text should:

  • Be actionable. Explain how to fix an error and if reasonable, why it happened so that it might also be prevented in the future.
  • Be concise and simple, maybe even more than normal. Avoid jargon. Try to keep error text to 2 sentences or fewer.
  • Use the passive voice for input errors to avoid placing blame on the user. For example, "A friendly name is required."
  • Use the active voice for system errors. For example, "Our systems are currently down. Please contact our support team."

Optional compositional elements

Optional compositional elements page anchor
  • Prefix/suffix — Use a prefix or suffix to help users format their input and to provide more context about the value a user is entering. For example, you could prefix or suffix a field with a currency symbol, or use suffix to append a character counter. Make sure to consider internationalization when using prefixes or suffixes since formatting may differ across languages. For example, currency symbols are placed on the left in American English, while they're placed on the right in French. Don't use prefix/suffix text as a replacement for a label.
  • Icon — Use an icon if you need to give the user additional controls for the field. For example, use an icon to clear a field on click, removing the need for users to manually delete their entered value. Place icon buttons that trigger an action on the right side of the field. If you need 2 actions on a field (e.g., popover trigger and clear field), place the icon button that affects the field value on the right, and the other icon on the left.
  • Placeholder — Use a placeholder when you want to give an example of the type of data a user should enter, mainly to help with recall. For example, when asking for links to social media profiles, you could give examples of a few social media sites. Placeholders should be used in addition to the label and not as a replacement since they'll disappear when a user begins entering their own value. If you need to show supporting instructions, use help text instead.

Use an input when users are expected to enter less than a single line of text, or text that's shorter than a sentence.


Use an input to encourage short text entry.


Don't use an input when text entry is expected to be longer than the width of the input since users may need to review the text before submission. Use a textarea instead.

Limit to 60 characters.

If you limit the length of text entry, show a character counter and explain to users in help text why their entry is restricted.


Don't have a character limit if you can't explain to the user why their text entry is restricted.

Use your work email address.

Use help text to help users prevent errors and fill out a form field correctly.


Don't use placeholder text for validation instructions.


Use the correct input type to help users format their text correctly and bring up dynamic keypads.


Don't use the default input type if there's a more specific one that can help users enter valid text more efficiently.

Use the following format: (###) ###-####

Keep help text and error text concise and simple. If you need to use more than 2 sentences to explain a field, link out to supporting docs or trigger a popover instead.

Go to your settings. Then click on email addresses. After doing that, copy and paste your email address in this field.

Don't use more than 2 sentences in help text or error text.


Include a visible label on every form field.


Don't use prefix/suffix text as a replacement for a label.


Use a disabled form field to show users that they can't interact with the field, but that it could potentially be enabled through another UI element.


Don't use a disabled form field to show information that can't be edited. Instead, use a read-only form field or consider another way of showing static information.

PropertyDefault tokenModifiable?
Label text
  • $font-size-30
  • Default: $color-text, $font-weight-semibold
  • Disabled: $color-text-weaker, $font-weight-semibold
Required field indicator
  • 4px size (0.25rem)
  • Background: $color-background-required
Box Shadow
  • Default: $shadow-border
  • Hover: $shadow-border-primary-strong
  • Disabled: $shadow-border-weak
  • Error: $shadow-border-error
  • Error hover: $shadow-border-error-strong
  • Default: $color-background-body
  • Disabled, Readonly: $color-background
  • Background: $color-background
  • Border: $color-border-lighter
Prefix/suffix text
  • Default: $color-text
  • Disabled: $color-text-weak
Value text
  • $font-size-30
  • Default, Readonly: $color-text
  • Disabled: $color-text-weaker
No, but it can take any children
Placeholder text $color-text-weak, italicNo
Help text$color-text-weak, $font-size-30No
Inline error
  • Text: $color-text-error, $font-size-30
  • Icon: IconError, $color-text-error, $icon-size-20
  • Label:
    • Bottom: $space-10
    • Between label and required indicator: $space-20
  • Input:
    • Left padding: $space-40
    • Top, right, bottom padding: $space-30
  • Prefix/suffix padding: $space-30
  • Help text:
    • Top: $space-30
  • Inline error:
    • Spacing between icon and text: $space-20
    • Top: $space-20

yarn add @twilio-paste/input - or - yarn add @twilio-paste/core
import {Input} from '@twilio-paste/core/input';
import {Label} from '@twilio-paste/core/label';
import {HelpText} from '@twilio-paste/core/help-text';
const Component = () => (
<Label htmlFor="foo" required>
<Input aria-describedby="foo_text" id="foo" name="foo" type="text" placeholder="foo" onChange={FOO} required />
<HelpText id="foo_text">Please enter some text</HelpText>

All the valid HTML attributes for input are supported including the following props:

id?stringSets the id of the input. Should match the htmlFor of Label.null
type'text', 'email', 'hidden', 'number', 'password', 'search', 'tel'Sets the type of the input. Required.null
name?stringSets the name of the input.null
value?stringSets the value of the input.null
placeholder?stringSets the placeholder of the input.null
disabled?booleanDisables the input.false
readOnly?booleanSets the input to readonly.false
required?booleanSets the input as required.false
hasError?booleanSets the input to an error state.false
onChange?(event: React.MouseEvent<HTMLElement>)null
onFocus?(event: React.MouseEvent<HTMLElement>)null
onBlur?(event: React.MouseEvent<HTMLElement>)null
variant?'default', 'inverse''default'
element?stringOverrides the default element name to apply unique styles with the Customization Provider'INPUT'

Black lives matter.