Switch
On/off switch on Base UI with a pill track and sliding thumb, in default and small sizes. Shows focus rings and invalid styling, and inverts its thumb colors in dark mode.
"use client"
import { Label } from "@/components/ui/label"
import { Switch } from "@/components/ui/switch"
/** Switch, on, with its Label. */
export default function SwitchDemo() {
return (
<div className="flex items-center gap-3">
<Switch id="grain" defaultChecked />
<Label htmlFor="grain">Film grain</Label>
</div>
)
}
Installation
pnpm dlx shadcn add @01orbital/switchnpx shadcn add @01orbital/switchyarn shadcn add @01orbital/switchbunx --bun shadcn add @01orbital/switchAdd the @01orbital registry to components.json once (install guide), then run the command.
It lands at components/ui/switch.tsx, as source you own and edit.
Examples
01
switch-cloud-dancer
Dependencies
npm: @base-ui/react, cn. The CLI installs them for you.
No other registry pieces.
Spinner
Loading indicator that spins the Phosphor spinner icon. It carries a status role and a Loading label so screen readers announce it, and it sizes to 16px by default.
Tabs
Tabbed panels on Base UI with a pill-shaped default list, or a line variant that marks the active tab with a bar instead. Works horizontally or as a vertical side list.