Forms
Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.
Overview
Bootstrap’s form controls expand on our Rebooted form styles with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices.
Be sure to use an appropriate type attribute on all inputs (e.g., email for email address or number for numerical information) to take advantage of newer input controls like email verification, number selection, and more.
Here’s a quick example to demonstrate Bootstrap’s form styles. Keep reading for documentation on required classes, form layout, and more.
Sizing
Set heights using classes like .form-control-lg
and .form-control-sm
.
Readonly
Add the readonly
boolean attribute on an input to prevent modification of the input’s value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.
Input groups
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.
Validation
Provide valuable, actionable feedback to your users with HTML5 form validation–available in all our supported browsers. Choose from the browser default validation feedback, or implement custom messages with our built-in classes and starter JavaScript.
We highly recommend custom validation styles as native browser defaults are not announced to screen readers.
Custom controls
For even more customization and cross browser consistency, use our completely custom form elements to replace the browser defaults. They’re built on top of semantic and accessible markup, so they’re solid replacements for any default form control.
Collapsible sections
Break big forms into collapsible sections with form-collapsible-section
component.
Nostra fermentum tellus fringilla hendrerit dictumst placerat amet, himenaeos enim etiam maecenas primis dis, porttitor class molestie consequat habitant ridiculus.
Nostra fermentum tellus fringilla hendrerit dictumst placerat amet, himenaeos enim etiam maecenas primis dis, porttitor class molestie consequat habitant ridiculus.