Skip to content

Switch theming

Every cosmetic value Switch renders is a --rozie-switch-* custom property with a built-in fallback, so the component works with zero configuration and stays fully re-skinnable. The structural rules compile per-leaf and are not consumer-overridable — only the values below flow through tokens.

css
.rozie-switch {
  --rozie-switch-width: 2.75rem;
  --rozie-switch-off-bg: rgba(0, 0, 0, 0.25);
  --rozie-switch-thumb-size: 1.25rem;
  --rozie-switch-focus-ring-width: 2px;
}

Tokens

track box model

TokenDefault
--rozie-switch-width2.75rem
--rozie-switch-height1.5rem
--rozie-switch-track-padding0.125rem
--rozie-switch-radius999px

track colors — off vs on (on is the single accent most consumers set)

TokenDefault
--rozie-switch-off-bgrgba(0, 0, 0, 0.25)
--rozie-switch-on-bg#0066cc

thumb

TokenDefault
--rozie-switch-thumb-size1.25rem
--rozie-switch-thumb-bg#fff
--rozie-switch-thumb-shadow0 1px 2px rgba(0, 0, 0, 0.3)
--rozie-switch-thumb-travelcalc(2.75rem - 1.5rem)

focus ring

TokenDefault
--rozie-switch-focus-ring-width2px
--rozie-switch-focus-ring-colorrgba(0, 102, 204, 0.5)
--rozie-switch-focus-ring-offset2px

disabled

TokenDefault
--rozie-switch-disabled-opacity0.55

Design-system bridges

Each package ships token presets that map Switch's tokens onto a known design system's published CSS variables — import base.css first, then a bridge:

ts
import '@rozie-ui/switch-react/themes/base.css';
import '@rozie-ui/switch-react/themes/bootstrap.css';
import '@rozie-ui/switch-react/themes/material.css';
import '@rozie-ui/switch-react/themes/shadcn.css';

See also

Pre-1.0 — APIs may change between minor versions.