Components•Switch
Components•Switch
Switch
A binary toggle for persistent on-or-off settings.
Dependencies
Copy below cli
npx shadcn add @bjork-ui/primitive-switchHow to use
import { BjorkSwitch } from "@/components/isaiahbjork/primitives";Props
classNamestringPass through styling hooks for the Switch primitive without replacing the base Bjork surface.
childrenReactNodeComposable content, labels, icons, and nested content where the primitive supports them.
checkedbooleanUse with onCheckedChange for controlled on-or-off settings.
Slider-style toggle
Use for persistent on/off preferences when the switch should stay as clean as the range control.
<BjorkSwitch aria-label="Enable preview" size="lg" defaultChecked/>