Skip to content

Text field

Text fields allow users to input custom text entries with a keyboard. Various options can be shown with the field to communicate the input requirements. Always use a label and associate the label to the field properly.

Labels can be placed either on top or on the side. Top labels are the default and are recommended because they work better with long copy, localization, and responsive layouts.

Help or instructional text goes here
<div class="form-group form-group--stacked">
<label for="textinput" class="form-label"> … </label>
<span class="help-block">
<span class="help-block__text"> … </span>
<span class="help-block__link"> … </span>
<!-- optional warning message -->
<div class="text-warning d-flex align-items-center space-x space-x-3">
<svg class="icon icon-16" aria-hidden="true">
<use xlink:href="/assets/svg/solid.svg#bell-on"></use>
</svg>
</div>
<!-- /optional warning message -->
</span>
<!-- error handling -->
<div class="form-error" role="alert">…</div>
<!-- /error handling -->
<input type="text" id="" value="" placeholder="Placeholder" class="form-control" />
</div>

Side labels are most useful when vertical space is limited.

(Required)
Help or instructional text goes here
<div class="form-group row">
<div class="col-sm-3 col-md-2 d-md-flex text-md-right flex-column align-items-end">
<label class="col-form-label" for="text-field">…</label>
<span class="help-inline">(Required)</span>
</div>
<div class="col-sm-9 col-md-10 input-width--md">
<input class="form-control" id="text-field" required="true" type="text" placeholder="Placeholder" />
<!-- error handling -->
<div class="form-error" role="alert">…</div>
<!-- /error handling -->
<span class="help-block">
<span class="help-block__text"> … </span>
<!-- optional warning message -->
<div class="text-warning d-flex align-items-center space-x space-x-3">
<svg class="icon icon-16" aria-hidden="true">
<use xlink:href="/assets/svg/solid.svg#bell-on"></use>
</svg>
</div>
<!-- /optional warning message -->
</span>
</div>
</div>
<input class="form-control" id="" type="text" placeholder="Placeholder">