Radio
Native radios with consistent spacing, focus and validation.
When to use
Use radios when a user can select exactly one option from a visible group, such as a delivery method or billing interval. Use Checkbox for independent choices that allow several selections, or Select when the options should appear in a compact dropdown.
Radio group
Combine .form-check with native type="radio" inputs using .form-check-input. Give the inputs the same name and distinct value attributes inside a fieldset named by its legend. Connect each visible label with matching for and id attributes; use checked for the initial selection.
<fieldset class="border border-0 min-w-0">
<legend class="mb-2">Choose an option</legend>
<div class="d-flex flex-column gap-2">
<div class="form-check">
<input
class="form-check-input"
id="radioGroupOne"
name="radioGroup"
type="radio"
value="option-one"
checked />
<label class="form-label" for="radioGroupOne">Option one</label>
</div>
<div class="form-check">
<input
class="form-check-input"
id="radioGroupTwo"
name="radioGroup"
type="radio"
value="option-two" />
<label class="form-label" for="radioGroupTwo">Option two</label>
</div>
<div class="form-check">
<input
class="form-check-input"
id="radioGroupThree"
name="radioGroup"
type="radio"
value="option-three" />
<label class="form-label" for="radioGroupThree">Option three</label>
</div>
</div>
</fieldset>Invalid
Combine .is-invalid and aria-invalid="true". Link every radio to feedback after the final .form-check with aria-describedby.
<fieldset class="border border-0 min-w-0">
<legend class="mb-2">Choose an option</legend>
<div class="form-check">
<input
class="form-check-input is-invalid"
id="radioInvalidOne"
name="radioInvalid"
type="radio"
value="option-one"
aria-invalid="true"
aria-describedby="radioInvalidFeedback" />
<label class="form-label" for="radioInvalidOne">Invalid option one</label>
</div>
<div class="form-check">
<input
class="form-check-input is-invalid"
id="radioInvalidTwo"
name="radioInvalid"
type="radio"
value="option-two"
aria-invalid="true"
aria-describedby="radioInvalidFeedback" />
<label class="form-label" for="radioInvalidTwo">Invalid option two</label>
</div>
<div class="invalid-feedback" id="radioInvalidFeedback">Please select one option.</div>
</fieldset>Disabled
Use the native disabled attribute to prevent an option from being selected or submitted.
<div class="form-check">
<input class="form-check-input" id="radioDisabled" name="radioDisabled" type="radio" disabled />
<label class="form-label" for="radioDisabled">Disabled radio</label>
</div>Accessibility and behavior
- Use
fieldsetandlegendto name the group, and keep a visible label connected to each input. Clicking a label selects its radio and increases the usable target area. - Keep the same
namefor mutually exclusive options and use a different name for each separate group in the same form. Selecting an option clears the previous selection in its group. - Tab and Shift+Tab move into and out of the group. Within a group, the arrow keys move focus and selection between enabled options; Space selects the focused radio. Preserve native keyboard behavior and the visible focus indicator.
- Only the checked, enabled radio contributes its
nameandvalueto native form submission. A group with no selection contributes no entry. Add nativerequiredto a radio when the group must have a selection; see Form. - Connect hints and errors with
aria-describedby..is-invalidstyles an error andaria-invalidcommunicates it; neither performs validation. Update these states and the feedback when application validation changes.
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-check-gap | var(--spacer-2) | Space between the input and label. | .form-check |
--form-check-input-size | 1rem | Checkbox or radio width and height. | .form-check-input |
--form-check-input-border-radius | var(--border-radius-sm, 0.25rem) | Checkbox corner radius; radios remain circular. | .form-check-input |
--form-check-input-bg-color | var(--bg-surface) | Unchecked control background. | .form-check-input |
--form-check-input-border-width | var(--border-width) | Control border thickness. | .form-check-input |
--form-check-input-border-color | var(--control-border-color) | Unchecked control border. | .form-check-input |
--form-check-input-checked-bg-color | var(--primary) | Checked or indeterminate background. | .form-check-input (checked / indeterminate) |
--form-check-input-checked-border-color | var(--primary) | Checked or indeterminate border. | .form-check-input (checked / indeterminate) |
--form-check-input-checked-color | var(--on-primary) | Checkmark, indeterminate bar or radio dot color. | .form-check-input (checked / indeterminate) |
--form-check-disabled-bg-color | var(--disabled-bg-color) | Background color while disabled. | .form-check-input (disabled) |
--form-check-disabled-border-color | var(--disabled-border-color) | Border color while disabled. | .form-check-input (disabled) |
--form-check-transition-duration | var(--transition-duration) | Duration of visual state transitions. | .form-check |
--form-check-transition-easing | var(--transition-easing) | Timing curve for visual state transitions. | .form-check |