One contract: Switch

Loom Base 1.0.0, MIT
Purpose
Turns a single setting on or off, taking effect immediately.
When not to use it
  • The choice is only applied after pressing Save: use Checkbox.
  • Choosing between more than two options: use RadioGroup.
States
off, on (off → on, on → off); flags: disabled
Keyboard and role
Space, Tab · role switch, the same on native
Tested behaviour
10 scenarios, run on web and native from this one file
Three of its 20 tokens, resolved from the component to the value
Component tokenResolves throughValue
track.background:checkedsemanticcolor.control.checkedprimitivecolor.palette.dye-indigo.800#1e2a78
track.border-colorsemanticcolor.border.strongprimitivecolor.palette.greige.500#716856
root.min-heightsemanticsize.target.minprimitivesize.scale.2424px
Read from packages/base/contracts/switch.contract.json and the token files when this page is built, so it always matches the code.