Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Components Text fields
This document is a preview.

Text fields

Text fields allow the user to input text. They can be single line, with or without scrolling, or multi-line, and can have an icon. Touching a text field places the cursor and automatically displays the keyboard. In addition to typing, text fields allow for a variety of other tasks, such as text selection (cut, copy, paste) and data lookup via auto-completion. See  Patterns > Selection  for text selection design.

Text fields can have different types. The type determines what kind of characters are allowed inside the field and may prompt the virtual keyboard to optimize its layout for frequently used characters. Common types include number, text, email address, phone number, person’s name, username, URL, street address, credit card number, PIN, and search query.

Single line text fields Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Single-line fields automatically scroll their content to the left as the text input cursor reaches the right edge of the input field.

Light Theme

  • Hint and input font: Roboto Regular 16 sp
  • Tile height: 48 dp
  • Text top and bottom padding: 16 dp
  • Text field divider padding: 8 dp

Dark Theme

Redlines

Light theme with icon

  • Hint and input font: Roboto Regular 16 sp
  • Tile height: 48 dp
  • Text top and bottom padding: 16 dp
  • Text field divider padding: 8dp

Dark theme with icon

Redlines

Single Line with Scrolling Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Single-Line with Scrolling

When text input in a single-line field is long and spans multiple lines, the text field should scroll to accommodate the text.

In the scrolling text field, a graphical indicator appears below the line. Touching the ellipsis jumps the cursor back to the beginning of the string.

Light theme

Dark theme

Floating Labels Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Floating Labels

With floating inline labels, when the user engages with the text input field, the labels move to float above the field.

Light theme

  • Hint and input font: Roboto Regular 16 sp
  • Label font: Roboto Regular 12 sp
  • Tile height: 72dp
  • Text top and bottom padding: 16dp
  • Text field divider padding: 8dp

Dark theme

Redlines

Multi-line-text field Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Multi-line text fields automatically break to a new line for overflow text and scroll vertically when the cursor reaches the lower edge.

Light Theme

  • Hint and input font: Roboto Regular 16 sp
  • Label font: Roboto Regular 12 sp
  • Text top and bottom padding: 16 dp
  • Text field divider padding: 8 dp

Dark Theme

Redlines

Full-width text field Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Full-width text fields are useful for more in-depth tasks.

Single and Multi-line fields

  • Hint and input font: Roboto Regular 16 sp
  • Top and bottom padding for text: 20 dp

Redlines

Character Counter Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Use a character counter in fields where a character restriction is in place.

Single Line with Character Counter

Counter is Roboto Regular 12sp

Multi-Line with Character Counter

  • Counter text: Roboto Regular 12 sp

Full Width with Character Counter

Auto-complete text field Expand and collapse content An arrow that points down when collapsed and points up when expanded.

Use auto-complete text fields to present real-time suggestions or completions in popups, so users can enter information more accurately and efficiently.

Full-width auto-Complete

Inset Auto-Complete

Full-width inline auto-complete

In-line auto-complete

Search Filter Expand and collapse content An arrow that points down when collapsed and points up when expanded.

The app bar can act as a text input field. As the user types, the content underneath it is filtered and sorted.

Full-width text field in app bar