Radio
Radios are styled by their wrapping label, which also gives you the card variant for bigger choice targets.
| Class | Does what |
|---|---|
radio | Custom radio dot |
label | On the wrapping label: row layout with a gap |
block | On the wrapping label: padded, bordered card that highlights when selected |
Basic
<label class="label">
<input type="radio" name="plan" class="radio" checked />
Monthly
</label>
<label class="label">
<input type="radio" name="plan" class="radio" />
Yearly
</label>
<label>
<input type="radio" name="plan" checked />
Monthly
</label>
<label>
<input type="radio" name="plan" />
Yearly
</label>
Card radios
<label class="label block">
<input type="radio" name="tier" class="radio" checked />
Hobby
</label>
<label class="label block">
<input type="radio" name="tier" class="radio" />
Team
</label>
<label class="block">
<input type="radio" name="tier" checked />
Hobby
</label>
<label class="block">
<input type="radio" name="tier" />
Team
</label>
Composition
Common ways to put this together with other components. The general rules are on Composition.
Choice cards
Each option is a bordered block with a title and a line; the chosen one is highlighted.
<fieldset class="fieldset">
<legend class="fieldset-legend">Plan</legend>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: var(--padding)">
<label class="label block">
<input type="radio" name="cplan" class="radio" checked />
<span><strong>Monthly</strong><br /><small class="text-secondary">Pay as you go, cancel any time</small></span>
</label>
<label class="label block">
<input type="radio" name="cplan" class="radio" />
<span><strong>Yearly</strong><br /><small class="text-secondary">Two months free</small></span>
</label>
</div>
</fieldset>
- Controls:
.label.blockdraws the border and fills the checked option with--fill; the radio still does the work. - Layout: a grid makes the options equal widths and stacks them on a phone.
A short list of options
Two or three options with a line each, stacked in a fieldset.
<fieldset class="fieldset">
<legend class="fieldset-legend">Delivery</legend>
<label class="label"><input type="radio" name="cdel" class="radio" checked /> Standard, 3 to 5 days</label>
<label class="label"><input type="radio" name="cdel" class="radio" /> Express, next day</label>
</fieldset>
- Controls: a radio inside a
.labellays out as a row; the legend names the choice once, so each option only says what differs.