Toggle
Toggle Primitive
Text Component
Demo
A button with a true or false state, which can be activated or deactivated by toggling.
Installation
Copy/paste the following code to ~/components/ui/toggle.tsx
:
Usage
Props
Toggle
Extends Pressable
props
Prop | Type | Note |
---|---|---|
pressed | boolean | |
onPressedChange | (val: boolean) => void | |
asChild | boolean | (optional) |
disabled | boolean | (optional) |
variant | ’default’ | ‘outline’ | (optional) |
size | ’default’ | ‘sm’ | ‘lg’ | (optional) |
ToggleIcon
Extends LucideIcon
props
Prop | Type | Note |
---|---|---|
icon | LucideIcon |