layout: docs
title: Form controls
description: Give textual form controls like <input>s and <textarea>s an upgrade with custom styles, sizing, focus states, and more.
group: forms
{{< example >}}
Set heights using classes like .form-control-lg and .form-control-sm.
{{< example >}} {{< /example >}}
Add the disabled boolean attribute on an input to give it a grayed out appearance and remove pointer events.
{{< example >}} {{< /example >}}
Add the readonly boolean attribute on an input to prevent modification of the input's value.
{{< example >}} {{< /example >}}
If you want to have <input readonly> elements in your form styled as plain text, use the .form-control-plaintext class to remove the default form field styling and preserve the correct margin and padding.
{{< example >}}
<label for="staticEmail" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="staticEmail" value="email@example.com">
</div>
<label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPassword">
</div>
{{< /example >}}
{{< example >}}
<label for="staticEmail2" class="visually-hidden">Email</label>
<input type="text" readonly class="form-control-plaintext" id="staticEmail2" value="email@example.com">
<label for="inputPassword2" class="visually-hidden">Password</label>
<input type="password" class="form-control" id="inputPassword2" placeholder="Password">
<button type="submit" class="btn btn-primary mb-3">Confirm identity</button>
{{< /example >}}
{{< example >}}
{{< example >}} Color picker {{< /example >}}
Datalists allow you to create a group of <option>s that can be accessed (and autocompleted) from within an <input>. These are similar to <select> elements, but come with more menu styling limitations and differences. While most browsers and operating systems include some support for <datalist> elements, their styling is inconsistent at best.
Learn more about support for datalist elements.
{{< example >}} Datalist example {{< /example >}}
$input-* are shared across most of our form controls (and not buttons).
{{< scss-docs name="form-input-variables" file="scss/_variables.scss" >}}
$form-label-* and $form-text-* are for our <label>s and .form-text component.
{{< scss-docs name="form-label-variables" file="scss/_variables.scss" >}}
{{< scss-docs name="form-text-variables" file="scss/_variables.scss" >}}
$form-file-* are for file input.
{{< scss-docs name="form-file-variables" file="scss/_variables.scss" >}}