# Text field **This documentation is fully rendered on the [Material Web catalog](https://material-web.dev/components/text-field/)** [Text fields](https://m3.material.io/components/text-fields) let users enter text into a UI. Several text fields in a form * [Design article](https://m3.material.io/components/text-fields) * [API Documentation](#api) * [Source code](https://github.com/material-components/material-web/tree/main/textfield) ## Types 1. [Filled text field](#filled-text-field) 1. [Outlined text field](#outlined-text-field) ## Usage Text fields behave like [``](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) elements. They provide a container with labels for user input. ![A filled textfield next to an outlined textfield. Both have a value of Value prefilled](images/textfield/usage.webp) ```html ``` ### Input type A text field's `type` attribute changes how the text field works, such as displaying a different keyboard or providing default validation. - [`type="text"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/text) (default) - [`type="email"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email) - [`type="number"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number) - [`type="password"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password) - [`type="search"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search) - [`type="tel"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel) - [`type="url"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url) - [`type="textarea"`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea) ![Two filled textfields next to each other. The first has a label of Username and the outlined one has a label of Password](images/textfield/usage-type.webp) ```html ``` > Tip: use the > [`inputmode`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) > attribute for more control over the displayed keyboard. ### Labels Text fields should label their value with a floating `label`, a `placeholder`, or an external label. Labels help the user understand what value to input. ![Three outlined textfields next to each other. the first has a label of Favorite food, the second one a placeholder of email@domain.com and there is a label that says First name and an empty outlined textfield next to it](images/textfield/usage-label.webp) ```html
First name
``` > Note: text fields do not currently support `aria-labelledby`. External labels > must provide an `aria-label`. See b/276484803. ### Textarea Multi-line text fields behave like [`