---
name: bootstrap-forms
description: This skill should be used when the user asks about Bootstrap forms, Bootstrap form controls, Bootstrap input fields, Bootstrap select, Bootstrap checkboxes, Bootstrap radio buttons, Bootstrap switches, Bootstrap range inputs, Bootstrap input groups, Bootstrap floating labels, Bootstrap form validation, Bootstrap form layout, how to create Bootstrap forms, needs help with form styling and validation in Bootstrap, wants to create a form, add form validation, style form inputs, make an inline form, add floating labels to inputs, create a login form, build a registration form, or validate user input.
---
# Bootstrap 5.3 Forms
Bootstrap provides comprehensive form styling including controls, layouts, validation states, and input groups.
## Form Controls
### Text Inputs
```html
```
### Sizing
To match input size with surrounding elements or emphasize important fields, use sizing classes. Use `.form-control-lg` for hero sections or primary CTAs. Use `.form-control-sm` for compact UIs like toolbars or inline forms.
```html
```
### Disabled and Readonly
Use `disabled` for fields users cannot interact with at all. Use `readonly` when values should be visible and selectable but not editable. Use `.form-control-plaintext` with `readonly` to display values without form styling.
```html
```
### File Input
```html
```
### Color Picker
```html
```
### Textarea
```html
```
### Help Text
Use `.form-text` for supplemental instructions. Connect help text to inputs with `aria-describedby` so screen readers announce it when the input is focused:
```html
Must be 8+ characters with one uppercase letter.
```
When an input has both help text and validation feedback, reference both in `aria-describedby`:
```html
We'll never share your email.
Please enter a valid email address.
```
## Select
```html
```
The `size` attribute displays multiple options without requiring `multiple` selection. Unlike `.form-select-lg` which changes visual scale, `size` controls how many options are visible at once. Use it for small option lists where showing all choices improves usability.
## Datalists
Datalists provide autocomplete suggestions for text inputs. They combine the flexibility of free-text input with the convenience of predefined options.
```html
```
Connect the input to the datalist using the `list` attribute matching the datalist's `id`. Users can type freely or select from suggestions. Datalist styling is browser-native and varies across browsers—Bootstrap's `.form-control` styles the input, but the dropdown appearance is not customizable.
## Checkboxes and Radios
### Checkboxes
```html
```
### Indeterminate Checkboxes
Use the indeterminate state for checkboxes representing a "partially checked" condition. This is useful for "select all" patterns where some but not all child items are checked. The state must be set via JavaScript—there is no HTML attribute for it.
```html
```
### Radios
```html
```
### Switches
Prefer switches over checkboxes for on/off settings that take effect immediately, like enabling notifications or toggling dark mode. Use checkboxes for multi-select options or when changes require a submit action.
```html
```
For iOS 17.4+ Safari, add the `switch` attribute to enable native haptic feedback:
```html
```
### Inline
```html
```
### Reverse Layout
Use `.form-check-reverse` to position the input on the opposite side—label first, checkbox/radio second. This creates a right-aligned input style useful for settings interfaces or RTL layouts.
```html
```
## Toggle Buttons
Use `.btn-check` to create button-styled checkboxes and radios. Unlike standard form checks, toggle buttons use `.btn` classes on the label for a button appearance while maintaining checkbox/radio semantics. Use them for segmented controls, filter toggles, and option selectors.
### Checkbox Toggle
```html
```
### Radio Toggle
Group radio toggles with the `name` attribute for single-select behavior:
```html
```
### Outlined Styles
Use `.btn-outline-*` for a lighter, bordered appearance:
```html
```
### Accessibility
Toggle buttons are announced by screen readers as "checked"/"not checked" since they are fundamentally checkboxes or radios. This differs from button plugin toggles announced as "button"/"button pressed". Choose based on semantics—use toggle buttons when the control represents a true on/off or selection state.
## Range
Range inputs provide a slider control. Use `.form-range` for consistent styling across browsers.
```html
```
### Displaying the Current Value
Use the `