# Switch

> An elegant, precision-engineered settings panel with sweep-fill switches, spring-glide thumbs, live status, native button behavior, and contrast-safe design-system adaptation in light and dark themes.

- Category: Switch
- Frameworks: Vanilla, React + CSS, React + Tailwind
- Design system: Sunset Coast
- Dark mode: yes
- Access: premium (Atheros AI Pass)
- Tags: toggle
- Page: https://builder.atheros.ai/components/switch
- Preview: https://d17nmjscumqk5d.cloudfront.net/builder/templates/tpl_builder_switch/preview-314efe4126be.webp

## Features

- Box-model-correct switch geometry — the thumb inset is derived via `calc()` from track, border, and thumb sizes, so the thumb is perfectly centered with identical 4px gaps in both the off and on positions
- On-fill sweep — a primary-colored layer glides across the track via `transform: scaleX` (GPU-friendly, transform-only)
- Spring-glide thumb driven purely by `transform: translateX` with an overshoot cubic-bezier, plus a transform-only press squash
- Tabler check icon spins and scales into the thumb on activation
- Docking-point micro detail — a tiny target dot marks where the thumb lands, fading out once covered
- Live "n of m on" status chip with a pulsing dot, announced via `aria-live="polite"`
- True `role="switch"` semantics with `aria-checked` synced on every change
- Clickable row labels with explicit name and description relationships
- 44px minimum button targets wrapped around the unchanged 52×30px visual tracks
- Row hover and `:focus-within` highlighting for a cohesive settings-card feel
- Native button keyboard support — Space and Enter activate the focused switch without duplicate handlers
- Fully respects `prefers-reduced-motion`

## Accessibility

- **Switch role** — Each control is a `<button>` with `role="switch"` and `aria-checked`
- **Label association** — Native `<label for>` forwards clicks; `aria-labelledby` and `aria-describedby` expose label and supporting text
- **Live status** — Atomic `aria-live="polite"` chip announces "n of m on" after every change
- **Keyboard activation** — Native `<button>` behavior handles Space and Enter exactly once
- **Focus indicators** — `:focus-visible` outline (primary-tinted) plus row `:focus-within` highlight
- **Target size** — A 44px outer button target centers the intentionally 52×30px visual track
- **Decorative icons** — Check, sun, and moon SVGs are hidden from assistive technology
- **Reduced motion** — `prefers-reduced-motion: reduce` disables all animations

## Keyboard shortcuts

- `Enter` — Toggle the focused switch
- `Space` — Toggle the focused switch
- `Tab` — Move focus between switches

## Common questions

**Which frameworks is Switch available in?**

Switch ships as Vanilla, React + CSS and React + Tailwind — HTML, CSS, JS and React source you can copy, download or clone into Atheros AI Builder.

**Is Switch free?**

Switch is a premium component. Anyone can preview it; the source, downloads and AI customisation are included with Atheros AI Pass.

**Does Switch support dark mode?**

Yes. Switch ships light and dark themes, both drawn from the Sunset Coast design system's tokens. Switch the preview to dark mode to compare them.

## Get the code

Preview Switch live, then sign in to copy or download the source, apply another design system, or ask the AI assistant to change it: https://builder.atheros.ai/components/switch

Every component on https://builder.atheros.ai is also reachable from Claude Code, Cursor and Codex through the Atheros MCP server (paid plans). Component index: https://builder.atheros.ai/llms-components.txt
