Checkbox 复选框
勾选一项,支持半选。
CheckboxLabel 把复选框和文字包在一个 label 里,点文字也能勾选。其余属性同 Radix Checkbox。
安装
pnpm dlx shadcn@latest add https://docs.linasan.cn/r/checkbox.json第一次装本站的组件前先在项目里执行一次 shadcn init,详见 安装。
用法
import { Checkbox, CheckboxLabel } from '@/components/ui/checkbox';
<CheckboxLabel checked={agree} onCheckedChange={setAgree}>同意协议</CheckboxLabel>