# Astryx Switch

> A toggle control for on/off states that take effect immediately. Supports labels, descriptions, loading states, and validation. Use it for settings or preferences that apply instantly. For changes requiring a form submission, use a checkbox instead. Under a finger it moves like the iOS switch on every touch screen: a press lifts the thumb, a drag across flips it, lifting the finger commits, and a tap toggles through the browser’s click. The thumb keeps its circle and size on every device, and under a coarse pointer the invisible hit area grows toward 44 × 44 px, stopping halfway to any neighbouring control so a tap goes to the nearer one. With reduced motion on, a change cross-fades on a touch screen and is immediate with a mouse.  Astryx by Meta. Source: https://astryx.atmeta.com/components/Switch

- Author: [Astryx](https://21st.dev/@Astryxdesign)
- License: mit
- Tags: Switch, Toggle
- npm dependencies: @astryxdesign/core, @astryxdesign/theme-neutral
- Live preview: https://21st.dev/@Astryxdesign/components/astryx-switch

## Install

```bash
npx shadcn@latest add "https://21st.dev/r/Astryxdesign/astryx-switch?api_key=$API_KEY_21ST"
```

Requires a 21st API key (generate one at https://21st.dev/mcp) passed as `API_KEY_21ST`. Free accounts get a limited number of installs per day; unlimited on a paid plan — see https://21st.dev/pricing.

Full component directory: https://21st.dev/llms.txt · More like this: https://21st.dev/community/components/s/switch.md
