Radio
Radio wraps a native radio input with customizable appearance for choosing one option from many.
Basic radio
Similar to checkboxes, radios are styled with the .radio class. However, there’s no custom SVG as we use pure CSS to style the input and its checked state.
<Radio id="radio" />With form field
Wrap Radio in a FormField layout wrapper and add your label. The grid layout places the radio and label side by side.
<div className="d-flex flex-column gap-2">
<FormField>
<Radio
id="radioLabel"
name="radios"
/>
<FormLabel
htmlFor="radioLabel"
plain
>
First example radio
</FormLabel>
</FormField>
<FormField>
<Radio
id="radioLabel2"
name="radios"
/>
<FormLabel
htmlFor="radioLabel2"
plain
>
Second example radio
</FormLabel>
</FormField>
</div>Description
Add a description or other content after the label. Wrap the label and description in FormFieldContent to ensure appropriate spacing and alignment.
<FormField>
<Radio id="radioLabelDescription" />
<FormFieldContent>
<FormLabel
className="fw-medium"
htmlFor="radioLabelDescription"
plain
>
Example new radio
</FormLabel>
<FormText>
Supporting description for the above label.
</FormText>
</FormFieldContent>
</FormField>Theme colors
Modify the appearance of checked radios with the theme prop. This will set the checked background and border color to the theme color.
<div className="d-flex flex-column gap-2">
<FormField>
<Radio
defaultChecked
id="radioprimary"
theme="primary"
/>
<FormLabel
htmlFor="radioprimary"
plain
>
Example primary radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radioaccent"
theme="accent"
/>
<FormLabel
htmlFor="radioaccent"
plain
>
Example accent radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radiosecondary"
theme="secondary"
/>
<FormLabel
htmlFor="radiosecondary"
plain
>
Example secondary radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radiosuccess"
theme="success"
/>
<FormLabel
htmlFor="radiosuccess"
plain
>
Example success radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radiodanger"
theme="danger"
/>
<FormLabel
htmlFor="radiodanger"
plain
>
Example danger radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radiowarning"
theme="warning"
/>
<FormLabel
htmlFor="radiowarning"
plain
>
Example warning radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radioinfo"
theme="info"
/>
<FormLabel
htmlFor="radioinfo"
plain
>
Example info radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radiodark"
theme="dark"
/>
<FormLabel
htmlFor="radiodark"
plain
>
Example dark radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radiolight"
theme="light"
/>
<FormLabel
htmlFor="radiolight"
plain
>
Example light radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radioinverse"
theme="inverse"
/>
<FormLabel
htmlFor="radioinverse"
plain
>
Example inverse radio
</FormLabel>
</FormField>
</div>Disabled
Set the disabled prop on Radio; its associated FormLabel is automatically styled in a lighter color to indicate the input's state.
<Stack gap={2}>
<FormField>
<Radio
disabled
id="radioDisabled"
/>
<FormLabel
htmlFor="radioDisabled"
plain
>
Example new radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
disabled
id="radioCheckedDisabled"
/>
<FormLabel
htmlFor="radioCheckedDisabled"
plain
>
Example checked disabled radio
</FormLabel>
</FormField>
</Stack>Sizes
Set size="sm" or size="lg" to make your radio appear smaller or larger.
<div className="d-flex flex-column gap-3">
<FormField>
<Radio
defaultChecked
id="radioSizeSm"
size="sm"
/>
<FormLabel
htmlFor="radioSizeSm"
plain
>
Small radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radioSizeMd"
/>
<FormLabel
htmlFor="radioSizeMd"
plain
>
Default radio
</FormLabel>
</FormField>
<FormField>
<Radio
defaultChecked
id="radioSizeLg"
size="lg"
/>
<FormLabel
htmlFor="radioSizeLg"
plain
>
Large radio
</FormLabel>
</FormField>
</div>CSS
Variables
Override the radio component's CSS variables for visual customization.
.example {
--bs-radio-size: 1.25rem;
--bs-radio-margin-block: 0.125rem;
--bs-radio-bg: var(--bs-bg-body);
--bs-radio-border-color: var(--bs-border-color);
--bs-radio-checked-bg: var(--bs-control-checked-bg);
--bs-radio-checked-border-color: var(--bs-control-checked-border-color);
--bs-radio-disabled-bg: var(--bs-control-disabled-bg);
--bs-radio-disabled-opacity: var(--bs-control-disabled-opacity);
}