# Switch Icon

> A toggle switch whose sliding thumb cross-fades a check icon when on and an x icon when off, with `role="switch"` semantics and full keyboard support — fully design-system agnostic.

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

## Features

- Sliding thumb driven purely by `transform: translateX` for GPU-friendly motion
- Check and x Tabler icons cross-fade via `opacity` as the thumb moves
- True `role="switch"` semantics with `aria-checked` synced on every change
- Live Enabled/Disabled state readout via `aria-live`
- Dark mode inverts the active track to carry the readable primary accent on dark surfaces
- Full keyboard support — Space and Enter activate the focused switch
- Fully respects `prefers-reduced-motion`

## Accessibility

- **Switch role** — The control is a `<button>` with `role="switch"` and `aria-checked`
- **Icon hiding** — Decorative check and x icons are `aria-hidden="true"`
- **Live state** — `aria-live="polite"` announces Enabled/Disabled changes
- **Keyboard activation** — Space and Enter toggle the focused switch
- **Focus indicators** — `:focus-visible` with `--ring` outline on all interactive elements
- **Reduced motion** — `prefers-reduced-motion: reduce` disables all animations

## Keyboard shortcuts

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

## Common questions

**Which frameworks is Switch Icon available in?**

Switch Icon 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 Icon free?**

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

**Does Switch Icon support dark mode?**

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

## Get the code

Preview Switch Icon 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-icon

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
