Primitives
Switch
On or off for one setting, when nothing else is on screen to compare it against. The track fills to assert the state; the slug that moves is the ink line in both states.
Rule 5 in a slot: on and off differ in what colour is in the track,
never in how bright the moving part is. It carries no block - a block belongs
to things you press, and a switch is a slot with something sitting in it -
but it keeps a full ink edge at the control weight, because an off switch
inside a panel is a surface on a surface and without the edge all you can see
is a slug floating in the card. --axi-switch-fill is read through a
fallback and never declared on the component, so it can be set on the switch
or on any ancestor: a switch that turns something dangerous on can fill in
--axi-danger and say so. The slug's travel is a calc() over the same
tokens the track is built from, so resizing it with the three size knobs
stays correct.
Off, on, dangerous, and compact
Only the colour in the slot changes between the first two<div class="axi-row">
<button class="axi-switch" type="button" role="switch" aria-checked="false" aria-label="Auto-start"><span class="axi-switch__knob"></span></button>
<button class="axi-switch" type="button" role="switch" aria-checked="true" aria-label="Notify on updates"><span class="axi-switch__knob"></span></button>
<button class="axi-switch" type="button" role="switch" aria-checked="true" aria-label="Allow injection" style="--axi-switch-fill: var(--axi-danger)"><span class="axi-switch__knob"></span></button>
<button class="axi-switch" type="button" role="switch" aria-checked="true" aria-label="Compact" style="--axi-switch-w: 32px; --axi-switch-h: 18px; --axi-switch-knob: 11px"><span class="axi-switch__knob"></span></button>
</div>
Knobs
| Property | Sets | Fallback |
|---|---|---|
--axi-switch-fill | the fill an on .axi-switch takes | var(--axi-accent) |
--axi-switch-w | a .axi-switch's track width | 46px |
--axi-switch-h | a .axi-switch's track height | 26px |
--axi-switch-knob | a .axi-switch's slug (knob) size | 16px |