Configurator
<oc-radio-button-v2><input type="radio" name="rb-cfg" aria-label="oc-auto"><label slot="label">Expressversand</label></oc-radio-button-v2>Usage
Anatomy
- Radio button
- Label
HTML
<div class="anatomy" style="display:block;width:max-content;margin:28px auto">
<oc-radio-button-v2 width-behavior="fit"><input type="radio" name="rb-an" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<span class="anatomy-pin" style="left:-16px;top:50%">1</span>
<span class="anatomy-pin" style="left:calc(100% + 16px);top:50%">2</span>
<ol class="anatomy-key"><li data-n="1">Radio button</li><li data-n="2">Label</li></ol>Variants
There are two variants of the Radio Button. Both come in size50 and size100.
- Default
- Error: The error variant is not only visualized by the error color but also by an error icon, which is due to accessibility.
Default, size 100
Error, size 100
Default, size 50
Error, size 50
HTML
<p class="demo-label">Default, size 100</p>
<oc-radio-button-v2 width-behavior="fit"><input type="radio" name="rb-var-1" aria-label="oc-auto"><label slot="label">Standardversand</label></oc-radio-button-v2>
<p class="demo-label">Error, size 100</p>
<oc-radio-button-v2 width-behavior="fit"><input type="radio" name="rb-var-2" aria-label="oc-auto"><label slot="label">Expressversand</label><span slot="error">Bitte wähle eine Versandart aus.</span></oc-radio-button-v2>
<p class="demo-label">Default, size 50</p>
<oc-radio-button-v2 size="50" width-behavior="fit"><input type="radio" name="rb-var-3" aria-label="oc-auto"><label slot="label">Standardversand</label></oc-radio-button-v2>
<p class="demo-label">Error, size 50</p>
<oc-radio-button-v2 size="50" width-behavior="fit"><input type="radio" name="rb-var-4" aria-label="oc-auto"><label slot="label">Expressversand</label><span slot="error">Bitte wähle eine Versandart aus.</span></oc-radio-button-v2>
Behavior
States
Enabled (hover, press, focus it)
Error
Disabled
HTML
<p class="demo-label">Enabled (hover, press, focus it)</p>
<oc-radio-button-v2><input type="radio" name="rb-st-a" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-st-b" checked aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<p class="demo-label">Error</p>
<oc-radio-button-v2><input type="radio" name="rb-st-c" aria-label="oc-auto"><label slot="label">Label</label><span slot="error"></span></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-st-d" checked aria-label="oc-auto"><label slot="label">Label</label><span slot="error"></span></oc-radio-button-v2>
<p class="demo-label">Disabled</p>
<oc-radio-button-v2><input type="radio" name="rb-st-e" disabled aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-st-f" checked disabled aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
Interaction
Users can check a radio button by tapping anywhere on it. The label is also part of the hitbox and ensures proper support in assistive technologies, improving usability and accessibility. Checking a radio button automatically unchecks other radio buttons in same group. There is also a disabled variant of the radio button that cannot be clicked or tapped.
Fitting
The radio button is 1.5rem high and 1.5rem wide. The label is set to fit-content by default, but it can be overwritten to fill-parent. Note, that the whole line is interactive in this case.
fit
fill (default)
Long label wraps
HTML
<p class="demo-label">fit</p>
<oc-radio-button-v2 width-behavior="fit"><input type="radio" name="rb-fit-a" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<p class="demo-label">fill (default)</p>
<oc-radio-button-v2><input type="radio" name="rb-fit-b" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<p class="demo-label">Long label wraps</p>
<oc-radio-button-v2><input type="radio" name="rb-fit-c" aria-label="oc-auto"><label slot="label">Lieferung an eine abweichende Lieferadresse</label></oc-radio-button-v2>
Placement
The radio button has a mandatory label which can be placed left or right with a small gap to the radio button. Ideally, there should be a 24px gap between radio buttons if they are placed vertically.
Label right (default)
Label left
HTML
<p class="demo-label">Label right (default)</p>
<oc-radio-button-v2 width-behavior="fit"><input type="radio" name="rb-pl-a" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<p class="demo-label">Label left</p>
<oc-radio-button-v2 width-behavior="fit" label-placement="left"><input type="radio" name="rb-pl-b" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
Vertical list, 24px gap
HTML
<p class="demo-label">Vertical list, 24px gap</p>
<oc-form-group-v1 orientation="vertical" gap="var(--oc-base-dimension-24)" oc-aria-label="Versandart">
<oc-radio-button-v2><input type="radio" name="rb-place" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-place" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-place" aria-label="oc-auto"><label slot="label">Label</label></oc-radio-button-v2>
</oc-form-group-v1>
Radio button vs. checkbox
Use radio buttons when only one option can be selected from a list (single selection). When multiple option can be selected you should use checkboxes (multiple selection).
Checkbox: several choices
Radio button: one choice
HTML
<p class="demo-label">Checkbox: several choices</p>
<oc-checkbox-v2><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Damen</label></oc-checkbox-v2>
<oc-checkbox-v2><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Herren</label></oc-checkbox-v2>
<oc-checkbox-v2><input type="checkbox" aria-label="oc-auto"><label slot="label">Kinder</label></oc-checkbox-v2>
<p class="demo-label">Radio button: one choice</p>
<oc-radio-button-v2><input type="radio" name="rb-vs-cb" aria-label="oc-auto"><label slot="label">Standardversand</label></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-vs-cb" checked aria-label="oc-auto"><label slot="label">Expressversand</label></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-vs-cb" aria-label="oc-auto"><label slot="label">Abholung</label></oc-radio-button-v2>
Best Practices
Fünf oder weniger Optionen:
Mehr als fünf Optionen:
This is the only way to ensure consistent behavior and layout.
HTML
<oc-radio-button-v2 width-behavior="fit"><input type="radio" name="rb-click" aria-label="oc-auto"><label slot="label">Auch der Text ist klickbar</label></oc-radio-button-v2>
Content Guidelines
Accessibility
Related components
Implementation
Live demo
Schritt 2 von 3
Wie möchtest du deine Lieferung?
Gesamtsumme
249,98 €
HTML
<div style="max-width:480px;margin:0 auto;display:grid;gap:24px">
<div style="display:grid;gap:4px">
<p class="oc-copy-75 oc-text-color-secondary">Schritt 2 von 3</p>
<p class="oc-headline-100">Wie möchtest du deine Lieferung?</p>
<oc-form-group-v1 orientation="vertical" gap="var(--oc-base-dimension-24)" oc-aria-label="Versandart">
<oc-radio-button-v2><input type="radio" name="rb-demo" checked aria-label="oc-auto"><label slot="label">Standardversand · kostenlos</label><span slot="hint">Lieferung Do., 02.10. bis Sa., 04.10.</span></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-demo" aria-label="oc-auto"><label slot="label">Expressversand · 9,95 €</label><span slot="hint">Bestellst du bis 12 Uhr, kommt dein Paket morgen.</span></oc-radio-button-v2>
<oc-radio-button-v2><input type="radio" name="rb-demo" aria-label="oc-auto"><label slot="label">Wunschtermin · 4,95 €</label><span slot="hint">Du wählst den Tag, wir liefern.</span></oc-radio-button-v2>
</oc-form-group-v1>
<oc-divider-v1></oc-divider-v1>
<p class="oc-copy-100"><b>Gesamtsumme</b></p>
<p class="oc-copy-100"><b>249,98 €</b></p>
<oc-button-v1 variant="primary">Weiter zur Zahlung</oc-button-v1>