Search
MaterialComponentsDocs
Components overviewApp barBadgeButtonsButton groupButtonExtended FABFAB menuFABIcon buttonSplit buttonCardCarouselCheckboxChipsDate & time pickersDate pickerTime pickerDialogDividerListLoading & progressLoading indicatorProgressMenuNavigationNavigation barNavigation drawerNavigation railRadio buttonsSearchSelectSheetsBottom sheetSide sheetSliderSnackbarSwitchTabsText fieldToolbarTooltip

Text field

Enter text with helpful context. Explore field styles, input types, icons, and validation states.

FactoryWeb ComponentsReactVueSvelteSolidJS

Accessibility

  • The label is a <label for> pointing at the input, so it names the field and a click on it focuses the input.
  • aria-describedby names the supporting text and the counter while they are shown, merged with ids you set yourself; aria-invalid="true" marks the error state.
  • name, required, readonly, maxlength, pattern, autocomplete, inputmode and enterkeyhint reach the native input, so native validation, password managers and virtual-keyboard hints work.
  • The default placeholder, a single space, is invisible and is not a label; a placeholder you pass shows while the field is focused or has no label.
  • Icon HTML is inserted as it is: a clickable reveal or clear icon needs its own role="button", tabindex and aria-label.
  • The keyboard is the browser's: Enter submits the form, except in multiline.