Switch

A setting you flip on or off, effective immediately.

import { Switch } from "@dede-style/ui/switch", then <Switch checked={on} onChange={setOn} label="Show guides" />. It is controlled — the value lives with whoever owns the setting, and this renders it.

PropDescriptionDefaultControl
checkedwhether the setting is on. Controlled: pass it with onChangefalse
labelthe visible label and the accessible name. Required. Name the setting (Show guides), not its state (Guides on)
descriptionan optional second line under the label
sizeheight 16, 20 or 24px (default). 24 is the comfortable touch target4566
  • 4
  • 5
  • 6
controlPositionthe switch after the label (end, default) or before itstartendend
fullWidthspread the row across its container, the switch at the far edge, as in a settings listfalse
isDisableddisables the switch and dims the rowfalse
hideLabelhide the label visually but keep it for screen readers, when the name is already on screenfalse

Tokens

What a theme can move, where the props above are what an instance can move.

Switch has none, and that is a decision rather than an omission. Every value it renders already resolves through a foundation token or a role, so a theme moves it by moving those. A component token earns its place only when a theme needs to change one component without changing the role beneath it.

These are public and overridable — there is no private custom property, because anything on :root is reachable by any stylesheet. What replaces privacy is a stability contract: primitives may move, roles are the guarantee, and these are the per-component escape from both.