Toggle
A latching key that stays lit while pressed. Set cipher to decode its label when switched on.
Component
Toggle belongs to the Actions group in the CyberSpec catalog. It uses @ui-sdk/react/toggle.
Installation
Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/toggle.json
Example
"use client"
import { BellOff, Flashlight, Radar } from "lucide-react"
import { Toggle } from "@/components/ui/toggle"
export default function ToggleDemo() {
return (
<>
<Toggle icon={<BellOff aria-hidden />} defaultPressed>
Silent mode
</Toggle>
<Toggle icon={<Flashlight aria-hidden />} aria-label="Torch" />
<Toggle icon={<Radar aria-hidden />} aria-label="Proximity ping" defaultPressed />
<Toggle size="sm" cipher>Autopilot</Toggle>
<Toggle disabled defaultPressed>
Uplink
</Toggle>
</>
)
}
Install this example
bunx --bun shadcn@latest add https://www.cyberspec.dev/r/toggle-demo.json