Componentes
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Switch
A control that allows the user to toggle between checked and not checked.
Installation#
pnpm add @ag/uiUsage#
import { Switch } from "@ag/ui"<Switch />Examples#
Description#
Choice Card#
Card-style selection where FieldLabel wraps the entire Field for a clickable card pattern.
Disabled#
Add the disabled prop to the Switch component to disable the switch. Add the data-disabled prop to the Field component for styling.
Invalid#
Add the aria-invalid prop to the Switch component to indicate an invalid state. Add the data-invalid prop to the Field component for styling.
Size#
Use the size prop to change the size of the switch.
RTL#
To enable RTL support in shadcn/ui, see the RTL configuration guide.
API Reference#
See the Radix Switch documentation.