Switch
A toggle control for switching between on and off states.
Import
import { Switch } from "@retents/ui/switch"Usage Guidelines
When to use
- For binary settings that take effect immediately, like "Enable notifications" or "Dark mode".
- When the toggle represents an on/off state with an immediate, real-time effect.
When NOT to use
- For form fields that require a submit action — use Checkbox instead.
- For selecting one of several options — use RadioGroup instead.
- For a toolbar action button that toggles a mode — use Toggle instead.
Preview
Off
Usage
<div className="flex items-center gap-2">
<Switch id="airplane-mode" />
<Label htmlFor="airplane-mode">Airplane Mode</Label>
</div>