2.0.0
Inputs allow a user to input and interact with data.
See Forms for guidance on composing full forms.
Use to solicit a short, single line of text or a number.
<input class="mds-form__input" type="text">
<input class="mds-form__input" type="text" disabled>
<input class="mds-form__input" type="text" placeholder="First Name">
Sizing affects input size, text size and internal spacing. The default size is medium, and you can use a modifier class to make inputs smaller (mds-form__input--small
) or larger (mds-form__input--large
).
<input class="mds-form__input mds-form__input--small" type="text" id="small-text-box" placeholder="First Name">
focus
. This is default behavior and a known issue, teams are still encouraged to use text boxes in production.placeholder
text to provide an example of the type of input you need from the user. For example, if you need a phone number in a certain format, include (123) 456-7890
as placeholder text. placeholder
text in place of a label
. See Labels for more information.aria-describedby
attribute on each input
that has an .mds-form__microcopy
or an .mds-form__field-error
component providing additional information. The value of the aria-describedby
attribute must match the id
attribute on the .mds-form__microcopy
or .mds-form__field-error
component.for
attribute on each label
with a value matching the id
attribute on the corresponding input
.mds-form__field-group
container.<div class="mds-form__field-group">
<label class="mds-form__label" for="first-name">First Name</label>
<input class="mds-form__input" type="text" id="first-name" placeholder="First Name" />
</div>
box-shadow
property to create an outline. Internet Explorer and Safari have known issues rendering these outlines when using the browser's zoom functionality. This visual defect doesn't affect the functionality of the component.
Class |
Applies to |
Outcome |
---|---|---|
|
|
Applies small styles to the input. |
|
|
Applies large styles to the input. |