A shadcn-style switch component built with Ark UI primitives.

Installation

npx shadcn@latest add @ark-cn/switch

Usage

import * as Switch from "@/components/ui/switch"

Read exported parts in src/components/ui/switch.tsx and compose the primitive according to the Ark UI pattern for this component.

Examples

Basic

Initial checked

Disabled

Controlled

Context

Root Provider

With Field

Additional Info

Card style

Nested

API reference

This component mirrors the upstream Ark UI primitive.

See the ARK UI documentation for the full API.

Accessibility

See the Ark UI documentation for clarification.