Input Groups
The input element is used to create interactive controls for web-based forms in order to accept data from the user; a wide variety of types of input data and control widgets are available, depending on the device and user agent. The element is one of the most powerful and complex in all of HTML due to the sheer number of combinations of input types and attributes.
Text field with helper text1/10
Variations
Basic Input
Copy as:
Basic Input Base Size:
copydone
Text field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10copydone
copydone
Basic Input Large Size:
copydone
Text field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydonecopydone
Outline Input
Copy as:
Outlined Input Base Size:
copydone
Text field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydonecopydone
Outlined Input Large Size:
copydone
Text field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydoneText field with helper text1/10
copydonecopydone
Usage
The <input>
fields allow users to enter text into a UI. They typically appear in forms and dialogs.
Specs
Input fields come in two basic styles (base and outlined) and 2 sizes:
- Base: text font size of 0.875rem (14px) and a label that scales from 0.875rem (14px) in font size, when the input is empty or 0.75rem (12px) when the label is floated. Helper text is also 0.75rem (12px) and a top and bottom margin of 1.5rem (24px) is used to house both the floating label and the helper text.
- Large: text font size of 1rem (16px) and a label that scales from 1rem (16px) in font size, when the input is empty or 0.75rem (12px) when the label is floated. Helper text is also 0.75rem (12px) and a top and bottom margin of 1.5rem (24px) is used to house both the floating label and the helper text.
Accessibility notes
For better accessibility when using the <input>
element:
- An id attribute to allow the
<input>
to be associated with a<label>
element for accessibility purposes. - A name attribute to set the name of the associated data point submitted to the server when the form is submitted.