{"name":"switch","title":"Switch","description":"","kind":"component","category":"inputs","status":"stable","props":{"checked":{"type":"boolean","default":false,"attr":"aria-checked","model":true},"size":{"type":"enum","values":["sm","md"],"default":"md","description":"md: 40×24. sm: 32×18."},"disabled":{"type":"boolean","default":false,"attr":"disabled"},"label":{"type":"string","attr":"aria-label","description":"Accessible name when there is no visible label."}},"playground":{"name":"Playground","props":{"checked":true},"text":"Deploy on push"},"exampleFiles":[{"file":"deploy-on-push","title":"Deploy on push"},{"file":"notifications","title":"Notification settings"},{"file":"environment-protection","title":"Password protection per environment (no visible label)"},{"file":"owner-only","title":"Only the owner can change it (disabled)"}],"worstCase":[{"name":"Long label","width":220,"text":"Automatically approve every edit the agent proposes to supplier records without asking first","props":{"checked":true}},{"name":"One letter","text":"A","props":{"checked":false,"size":"sm"}},{"name":"Right to left","text":"الموافقة التلقائية على التعديلات","props":{"checked":true}}],"anatomy":[{"part":"root","element":"button","description":"role=switch; aria-checked Wrapper rule: class and style land on this outermost element (what a caller sizes and places); every other attribute stays on the control."},{"part":"thumb","element":"span","description":"Travels on translate, squeezes on scale while pressed. Carries kbd-instant."},{"part":"label","element":"label","optional":true,"description":"Wraps the switch and its text; a click on the text toggles and the text is the accessible name. In the adapters it is rendered when there is a visible label, and `class` and `style` then land on it (the outermost element: what a caller sizes and places); every other attribute stays on the button."},{"part":"label-text","element":"span","optional":true}],"slots":{"default":"Visible label. When given, the switch is wrapped in the label part."},"events":{"checkedChange":"(checked: boolean) after a toggle"},"states":["checked","hover","press","focus-visible","disabled"],"tokens":["color.ink","color.ink-3","color.on-ink","color.on-accent","color.line-strong","radius.pill","text.sm","duration.base","duration.move","duration.press","easing.move","easing.out-strong","motion.press-scale-sm"],"a11y":{"role":"switch","keyboard":["Space / Enter toggle"],"notes":["Name it with the label wrapper, aria-labelledby, or the label prop (aria-label).","State is aria-checked, which is also what the recipe keys on.","A toggle from the keyboard moves the thumb instantly.","To set it from outside, control `checked`: React checked / onCheckedChange, Vue v-model:checked, Svelte bind:checked."]},"motion":["thumb: translate over duration.move with easing.move (pointer only)","press (pointer only): thumb scales to motion.press-scale-sm over duration.press with easing.out-strong; none from Space / Enter","track: colour over duration.base"]}