Toggle Group
Toggle Group Primitive
Text Component
Demo
A collection of buttons with true or false states, which can be activated or deactivated by toggling.
Installation
Copy/paste the following code to ~/components/ui/toggle-group.tsx
:
Usage
Props
ToggleGroup
Extends View
props
Prop | Type | Note |
---|---|---|
type | ’single’ | ‘multiple’ | |
value | string | undefined | string[] | |
onValueChange | (val: string | undefined | string[]) => void | |
asChild | boolean | (optional) |
disabled | boolean | (optional) |
rovingFocus | boolean | Web only (optional) |
orientation | ’horizontal’ | ‘vertical’ | Web only (optional) |
dir | ’ltr’ | ‘rtl’ | Web only (optional) |
ltr | boolean | Web only (optional) |
ToggleGroupItem
Extends Pressable
props
Prop | Type | Note |
---|---|---|
value | string | |
asChild | boolean | (optional) |
variant | ’default’ | ‘outline’ | (optional) |
size | ’default’ | ‘sm’ | ‘lg’ | (optional) |
ToggleIcon
Extends LucideIcon
props
Prop | Type | Note |
---|---|---|
icon | LucideIcon |