Toggle
Binary on/off switch built on Radix Toggle. Supports controlled (pressed + onPressedChange) and uncontrolled (defaultPressed) usage. Always provide a visible label or an aria-label for accessibility.
Examples
Loading examples…
API
From COMPONENTS.md.
Binary on/off switch.
<Toggle
pressed={isDark} // boolean — controlled
onPressedChange={toggleTheme} // (boolean) => void
label="Dark mode" // ReactNode — visible label; also names the switch (aria-labelledby)
aria-label="Toggle dark mode" // required if no visible label; overrides `label` as the name
disabled={false}
/>