Components
- 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
Get Started
import { Label } from "@/components/ui/label"
import { Switch } from "@/components/ui/switch"
Installation
pnpm dlx shadcn@latest add switch
Usage
import { Switch } from "@/components/ui/switch"<Switch />Examples
Description
Focus is shared across devices, and turns off when you leave the app.
import {
Field,
FieldContent,Choice Card
Card-style selection where FieldLabel wraps the entire Field for a clickable card pattern.
import {
Field,
FieldContent,Disabled
Add the disabled prop to the Switch component to disable the switch. Add the data-disabled prop to the Field component for styling.
import { Field, FieldLabel } from "@/components/ui/field"
import { Switch } from "@/components/ui/switch"
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.
You must accept the terms and conditions to continue.
import {
Field,
FieldContent,Size
Use the size prop to change the size of the switch.
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Switch } from "@/components/ui/switch"
RTL
To enable RTL support in StyleDriven UI, see the RTL configuration guide.
يتم مشاركة التركيز عبر الأجهزة، ويتم إيقاف تشغيله عند مغادرة التطبيق.
"use client"
import * as React from "react"API Reference
See the Radix Switch documentation.
Deploy your StyleDriven UI app on Vercel
Trusted by OpenAI, Sonos, Adobe, and more.
Vercel provides tools and infrastructure to deploy apps and features at scale.
Deploy to Vercel