Configurator
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Push-Benachrichtigungen</label></oc-switch-v3>Usage
Anatomy
- Track (grey off, green on)
- Handle
- Check icon when checked
- Label
HTML
<div class="anatomy">
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<span class="anatomy-pin" style="left:-16px;top:25%">1</span>
<span class="anatomy-pin" style="left:11%;top:-14px">2</span>
<span class="anatomy-pin" style="left:26%;top:calc(100% + 14px)">3</span>
<span class="anatomy-pin" style="left:calc(100% + 16px);top:25%">4</span>
<ol class="anatomy-key"><li data-n="1">Track (grey off, green on)</li><li data-n="2">Handle</li><li data-n="3">Check icon when checked</li><li data-n="4">Label</li></ol>Variants
The switch is available in sizes 50 and 100. There is also a loading variant for actions that take longer. When checked, the background color changes and the handle displays a check icon.
Size 50
Size 100
HTML
<p class="demo-label">Size 50</p>
<oc-switch-v3 size="50"><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<p class="demo-label">Size 100</p>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
Size 50
Size 100
HTML
<p class="demo-label">Size 50</p>
<oc-switch-v3 loading size="50"><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3 loading size="50"><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<p class="demo-label">Size 100</p>
<oc-switch-v3 loading><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3 loading><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
Unchecked
Checked
HTML
<p class="demo-label">Unchecked</p>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<p class="demo-label">Checked</p>
<oc-switch-v3><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
Behavior
States
Enabled (hover, press and focus it)
Disabled
HTML
<p class="demo-label">Enabled (hover, press and focus it)</p>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<p class="demo-label">Disabled</p>
<oc-switch-v3><input type="checkbox" disabled aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" checked disabled aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
Interaction
Users can check the switches by tapping anywhere on it. The label is also part of the hitbox and ensures proper support in assistive technologies, improving usability and accessibility. To uncheck the switch, it may be tapped again. There is also a disabled variant that cannot be clicked or tapped.
tap anywhere on the switch to check it
↓
tap anywhere on the switch to uncheck it
↓
HTML
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
Fitting
The width of the switch is set to fit-content by default, but can be set to fill-parent. Note, that the whole line is interactive in this case. The height of the label is set to fit-content.
width-behavior fit
width-behavior fill
HTML
<p class="demo-label">width-behavior fit</p>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<p class="demo-label">width-behavior fill</p>
<oc-switch-v3 width-behavior="fill"><input type="checkbox" aria-label="oc-auto"><label slot="label">hier steht ein sehr, sehr, sehr, sehr langes Label</label></oc-switch-v3>
Placement
The switch has a mandatory label which can be placed left or right. Ideally, there should be a 24px gap between switches if they are placed vertically. When placing multiple switches vertically, make sure to align them properly.
HTML
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<oc-switch-v3 style="max-width:7rem"><input type="checkbox" aria-label="oc-auto"><label slot="label">Long Label</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
label-placement right (default)
label-placement left
HTML
<p class="demo-label">label-placement right (default)</p>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
<p class="demo-label">label-placement left</p>
<oc-switch-v3 label-placement="left"><input type="checkbox" aria-label="oc-auto"><label slot="label">Label</label></oc-switch-v3>
Switch vs. checkbox
Use the switch for immediate actions, such as toggling a setting on or off. The action happens the moment the user interacts with it.
Use the checkbox when a separate interaction is needed to confirm a choice, such as "Speichern" or "Bestätigen", or when multiple options can be selected simultaneously as part of a larger form.
Checkbox: confirmed with a button
Switch: takes effect at once
HTML
<p class="demo-label">Checkbox: confirmed with a button</p>
<oc-checkbox-v2><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Ich möchte den OTTO-Newsletter erhalten.</label></oc-checkbox-v2>
<oc-button-v1 variant="primary">Weiter</oc-button-v1>
<p class="demo-label">Switch: takes effect at once</p>
<oc-switch-v3><input type="checkbox" checked aria-label="oc-auto"><label slot="label">OTTO-Newsletter erhalten</label></oc-switch-v3>
Do not use switches for lists consisting of multiple options. Instead, use checkboxes. Checkboxes imply that the items are related and take up less visual space than switches.
Do
Kategorie
HTML
<p class="demo-title" style="color:var(--oc-semantic-color-text-secondary,#6d6d6d)">Kategorie</p>
<oc-checkbox-v2><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Fernseher</label></oc-checkbox-v2>
<oc-checkbox-v2><input type="checkbox" aria-label="oc-auto"><label slot="label">TV-Wandhalterung</label></oc-checkbox-v2>
<oc-checkbox-v2><input type="checkbox" aria-label="oc-auto"><label slot="label">TV-Wände</label></oc-checkbox-v2>
Don't
Kategorie
HTML
<p class="demo-title" style="color:var(--oc-semantic-color-text-secondary,#6d6d6d)">Kategorie</p>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">Fernseher</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" checked aria-label="oc-auto"><label slot="label">TV-Wandhalterung</label></oc-switch-v3>
<oc-switch-v3><input type="checkbox" aria-label="oc-auto"><label slot="label">TV-Wände</label></oc-switch-v3>
Best practices
Content guidelines
Accessibility
Related components
Implementation
Live demo
Benachrichtigungen
Lege fest, worüber wir dich per Push informieren. Deine Auswahl gilt sofort.
Versand, Zustelltermin und Rücksendungen
Wenn Artikel auf deinem Merkzettel günstiger werden
Persönliche Gutscheine und Sale-Starts
Wird gespeichert …
HTML
<div style="max-width:440px;margin:0 auto;display:grid;gap:16px">
<div style="display:flex;align-items:center;gap:8px"><oc-icon-button-v3 icon="arrow-left" variant="transparent" oc-aria-label="Zurück"></oc-icon-button-v3><p class="oc-headline-100">Benachrichtigungen</p></div>
<p class="oc-copy-100 oc-text-color-secondary">Lege fest, worüber wir dich per Push informieren. Deine Auswahl gilt sofort.</p>
<div style="display:grid;gap:4px">
<oc-switch-v3 width-behavior="fill" label-placement="left"><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Bestellstatus und Lieferung</label></oc-switch-v3>
<p class="oc-copy-75 oc-text-color-secondary">Versand, Zustelltermin und Rücksendungen</p>
<oc-divider-v1></oc-divider-v1>
<div style="display:grid;gap:4px">
<oc-switch-v3 width-behavior="fill" label-placement="left"><input type="checkbox" checked aria-label="oc-auto"><label slot="label">Preisalarm</label></oc-switch-v3>
<p class="oc-copy-75 oc-text-color-secondary">Wenn Artikel auf deinem Merkzettel günstiger werden</p>
<oc-divider-v1></oc-divider-v1>
<div style="display:grid;gap:4px">
<oc-switch-v3 width-behavior="fill" label-placement="left"><input type="checkbox" aria-label="oc-auto"><label slot="label">Angebote und Aktionen</label></oc-switch-v3>
<p class="oc-copy-75 oc-text-color-secondary">Persönliche Gutscheine und Sale-Starts</p>
<oc-divider-v1></oc-divider-v1>
<div style="display:grid;gap:4px">
<oc-switch-v3 width-behavior="fill" label-placement="left" loading><input type="checkbox" aria-label="oc-auto"><label slot="label">Neuheiten deiner Lieblingsmarken</label></oc-switch-v3>
<p class="oc-copy-75 oc-text-color-secondary">Wird gespeichert …</p>