Skip to content

Search

Start typing to search.


Show all pages

Documentation

controls

Switch

An on and off control for a setting that takes effect at once.

CSS onlyPlain classes; no JavaScript in any stack.

Usage

A checkbox with role="switch" inside the label. Screen readers announce it as on or off.

HTML

Examples

Settings

Group related switches in a <fieldset> with a <legend>.

Notifications
HTML

Guidance and accessibility

When to use

  • Use a switch for a setting that applies the moment it changes, such as notifications or showing weekends.
  • When the choice only counts after a Save button, use a checkbox.
  • Write the label as the state that is on: “Email me about changes”.

Accessibility

  • It is a native checkbox with role="switch": Space toggles it, and screen readers say “on” or “off” instead of “checked”.
  • The thumb’s position and the track color both show the state; the label says what it controls.
  • In forced colors the skin’s drawing gives way to the native checkbox, so the state stays visible.
  • When the change saves something, confirm it, for example with an alert that uses role="status".

Classes

Generated from the component contract. Parts use __, modifiers use --.

Classes of the switch component
ClassKindUse it for
ca-switchComponentThe <label> around the switch and its text; the click and touch target.
ca-switch__inputPartA native checkbox with role="switch"; the skin draws the track and thumb.

Skins

The same markup, dressed by each skin. Structure and behavior stay the same; only the look changes.

Base skin

Neutral grayscale starting point; product skins extend it and change what differs.

Calaca skin

The Calaca UI brand: hueso paper and tinta ink, cempasúchil marigold, rosa and jade.

Proof skin

Pilot skin pushed far from base: square, heavy, offset shadows, larger targets.

Crossview skin

The CrossView proofing table: cool ground, bond-paper sheets, rule-grey hairlines, one red mark.

Framework notes

Link the prebuilt stylesheet of your skin next to your brand theme. No build step.

HTML
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="ca-base.css" />