Select
Native selects with consistent spacing, focus and validation.
When to use
Use a native select when users choose from a fixed list of options in a compact control. Use Radio for a short set that should stay visible, or Input for free text.
Select
Apply .form-select to native selects.
<div>
<label class="form-label" for="selectExample">Select label</label>
<select class="form-select" id="selectExample" name="selectExample">
<option value="not-specified">not specified</option>
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</div>Invalid
Use aria-invalid="true" and link feedback with aria-describedby and its id.
Please select a status.
<div>
<label class="form-label" for="invalidSelect">Invalid select</label>
<select
class="form-select is-invalid"
id="invalidSelect"
name="invalidSelect"
aria-invalid="true"
aria-describedby="invalidSelectFeedback">
<option value="">Please select</option>
<option value="active">Active</option>
<option value="pending">Pending</option>
</select>
<div class="invalid-feedback" id="invalidSelectFeedback">Please select a status.</div>
</div>Disabled
<div>
<label class="form-label" for="disabledSelect">Disabled select</label>
<select class="form-select" id="disabledSelect" disabled>
<option>Disabled select</option>
</select>
</div>Accessibility and behavior
- Connect a visible label with matching
forandidattributes. Give submitted controls anameand each option an explicitvalue. - Keep the native keyboard and touch picker behavior. Use
disabledfor unavailable choices and nativerequiredwith an empty-valued placeholder when selection is mandatory. - After validation fails, apply
.is-invalidandaria-invalid, and connect feedback witharia-describedby. These styles and attributes do not perform validation.
CSS variables
Override these base defaults on the listed selector after the library styles. Variants and states may replace them; global tokens follow the active theme.
| Token | Default | Purpose | Scope / state |
|---|---|---|---|
--form-select-bg-color | var(--bg-surface) | Background color. | .form-select |
--form-select-border-width | var(--border-width) | Border thickness. | .form-select |
--form-select-border-color | var(--control-border-color) | Border color. | .form-select |
--form-select-border-radius | var(--border-radius) | Corner radius. | .form-select |
--form-select-padding-y | var(--spacer-1) | Top and bottom padding. | .form-select |
--form-select-padding-x | var(--spacer-3) | Left and right padding. | .form-select |
--form-select-indicator-padding | var(--spacer-5) | Space reserved for the select arrow at the inline end. | .form-select |
--form-select-font-size | var(--font-size) | Text size. | .form-select |
--form-select-font-weight | 400 | Text weight. | .form-select |
--form-select-disabled-text-color | var(--disabled-text-color) | Text color while disabled. | .form-select (disabled) |
--form-select-disabled-bg-color | var(--disabled-bg-color) | Background color while disabled. | .form-select (disabled) |
--form-select-disabled-border-color | var(--disabled-border-color) | Border color while disabled. | .form-select (disabled) |
--form-select-focus-border-color | var(--primary-hover) | Border color while focused. | .form-select (focus) |
--form-select-focus-outline-width | var(--focus-outline-width) | Focus ring thickness. | .form-select (focus) |
--form-select-focus-outline-style | var(--focus-outline-style) | Focus ring line style. | .form-select (focus) |
--form-select-focus-outline-color | var(--focus-outline-color) | Focus ring color. | .form-select (focus) |
--form-select-focus-outline-offset | var(--focus-offset) | Distance between the focus ring and control. | .form-select (focus) |
--form-select-transition-duration | var(--transition-duration) | Duration of visual state transitions. | .form-select |
--form-select-transition-easing | var(--transition-easing) | Timing curve for visual state transitions. | .form-select |