Off and on
Put the label next to the switch and point to it with aria-labelledby. Click a switch, or Tab to it and press Space.
Sync orders automatically
Email me when a sync fails
example.html
<span class="bh-switch-field">
<button class="bh-switch" type="button" role="switch" aria-checked="false" aria-labelledby="sw-sync"></button>
<span id="sw-sync">Sync orders automatically</span>
</span>
<span class="bh-switch-field">
<button class="bh-switch" type="button" role="switch" aria-checked="true" aria-labelledby="sw-email"></button>
<span id="sw-email">Email me when a sync fails</span>
</span>Disabled
Use it only when the setting can’t be changed right now, and say why next to it.
Sync inventory
Turn on order sync first.
Sync ordersOnly a workspace admin can change this.
example.html
<span class="bh-switch-field">
<button class="bh-switch" type="button" role="switch" aria-checked="false" aria-labelledby="sw-off-disabled" aria-describedby="sw-off-why" disabled></button>
<span id="sw-off-disabled">Sync inventory</span>
</span>
<p class="bh-switch-hint" id="sw-off-why">Turn on order sync first.</p>
<span class="bh-switch-field">
<button class="bh-switch" type="button" role="switch" aria-checked="true" aria-labelledby="sw-on-disabled" aria-describedby="sw-on-why" disabled></button>
<span id="sw-on-disabled">Sync orders</span>
</span>
<p class="bh-switch-hint" id="sw-on-why">Only a workspace admin can change this.</p>