Components
- Accordion
- Action BarUpdated
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- BadgeUpdated
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- CalendarUpdated
- CardUpdated
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context MenuUpdated
- Data List
- Date Picker
- DialogUpdated
- DrawerUpdated
- Editable
- FieldUpdated
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- MarqueeUpdated
- Menu
- Native Select
- Number InputUpdated
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- TableUpdated
- Tabs
- Textarea
- TimerUpdated
- ToastUpdated
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Hooks
Installation#
pnpm dlx shadcn@latest add @shark/toggle
Usage#
import { Toggle, ToggleIndicator } from "@/components/ui/toggle";
<Toggle> <ToggleIndicator /> </Toggle>
Controlled#
Use the pressed and onPressedChange props to control the toggle state programmatically.
❌
States#
Disabled#
Use the disabled prop to disable the toggle.
Variants#
Default#
Outline#
Sizes#
Small#
Medium#
Large#
Examples#
Icon Group#
Use multiple toggles with icons for toolbar-style controls.
API Reference#
Toggle#
Toggle button for on/off or selected state. Use asChild for custom elements.
| Prop | Type | Default |
|---|---|---|
variant | "outline" | "ghost" | "ghost" |
size | "sm" | "md" | "lg" | "md" |
pressed | boolean | - |
defaultPressed | boolean | false |
disabled | boolean | false |
onPressedChange | (details: PressedChangeDetails) => void | - |
className | string | - |
asChild | boolean | false |
ToggleIndicator#
Icon or indicator shown when toggle is active. Omitted when used as child.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
For a complete list of props, see the Ark UI documentation.