Switch 开关开 / 关。StatusSwitch 在旁边显示状态文字。复制 Markdown预览代码接收通知正常 安装复制链接 pnpmnpmbunyarn手动复制代码pnpm dlx shadcn@latest add https://docs.linasan.cn/r/switch.json第一次装本站的组件前先在项目里执行一次 shadcn init,详见 安装。 用法复制链接 复制代码import { StatusSwitch, Switch } from '@/components/ui/switch'; <StatusSwitch checked={user.enabled} onCheckedChange={toggle} /> 属性复制链接 属性类型checkeduniononCheckedChange?functiondisabled?unionon?stringoff?stringlabel?stringRadioGroup 单选从几项里选一项;RadioCards 是带说明的卡片式单选。Slider 滑块拖动选择一个值或一个区间。