Forms
Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.
Form controls
Give textual form controls like <input>
s and <textarea>
s an upgrade with custom styles, sizing, focus states, and more.
Example
Sizing
Disabled
File input
Form text
Color
Floating labels
Create beautifully simple form labels that float over your input fields.
Example
Selects
Textarea
Select
Customize the native <select>
s with custom CSS that changes the element’s initial appearance.
Default
Sizing
Disabled
Checks and radios
Create consistent cross-browser and cross-device checkboxes and radios with our completely rewritten checks component.
Checks
Radios
Switches
Inline layout
Toggle buttons
Create button-like checkboxes and radio buttons by using .btn
styles rather than .form-check-label
on the <label>
elements. These toggle buttons can further be grouped in a button group if needed.
Checkbox toggle buttons
Radio toggle buttons
Range
Use our custom range inputs for consistent cross-browser styling and built-in customization.
Range basic
Min and max
Range inputs have implicit values for min
and max
—0
and 100
, respectively. You may specify new values for those using the min
and max
attributes.
Steps
By default, range inputs “snap” to integer values. To change this, you can specify a step
value. In the example below, we double the number of steps by using step="0.5"
.
Input group
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.
Basic
Sizing
Checkboxes and radios
Multiple inputs
Multiple addons
Button addons
Button with dropdowns
Segmented buttons
Custom select
Custom file input
Validations
Provide valuable, actionable feedback to your users with HTML5 form validation, via browser default behaviors or custom styles and JavaScript.
Example
For custom Bootstrap form validation messages, you’ll need to add the novalidate
boolean attribute to your <form>
. This disables the browser default feedback tooltips, but still provides access to the form validation APIs in JavaScript. Try to submit the form below; our JavaScript will intercept the submit button and relay feedback to you. When attempting to submit, you’ll see the :invalid
and :valid
styles applied to your form controls.
Custom feedback styles apply custom colors, borders, focus styles, and background icons to better communicate feedback. Background icons for <select>
s are only available with .form-select
, and not .form-control
.
Tooltips style
If your form layout allows it, you can swap the .{valid|invalid}-feedback
classes for .{valid|invalid}-tooltip
classes to display validation feedback in a styled tooltip. Be sure to have a parent with position: relative
on it for tooltip positioning. In the example below, our column classes have this already, but your project may require an alternative setup.