Components
Checkbox Group
Coordinates shared selection state across multiple checkboxes, including automatic parent indeterminate sync and tree connectors.
import { Checkbox } from "@/components/ui/checkbox";
import { CheckboxGroup } from "@/components/ui/checkbox-group";
const channels = [
{ label: "Email digest", value: "email" },
{ label: "Slack alerts", value: "slack" },
{ label: "Webhook events", value: "webhook" },
];
export default function Particle() {
return (
<CheckboxGroup defaultValue={["email", "slack"]}>
{channels.map((channel) => (
<label
className="inline-flex cursor-pointer select-none items-center gap-2.5 text-foreground text-sm leading-5"
key={channel.value}
>
<Checkbox value={channel.value} />
{channel.label}
</label>
))}
</CheckboxGroup>
);
}
Installation
pnpm dlx shadcn@latest add @taut-ui/checkbox-group
Usage
import { Checkbox } from "@/components/ui/checkbox"
import { CheckboxGroup } from "@/components/ui/checkbox-group"<CheckboxGroup defaultValue={["email"]}>
<label className="inline-flex items-center gap-2.5 text-sm">
<Checkbox value="email" />
Email
</label>
<label className="inline-flex items-center gap-2.5 text-sm">
<Checkbox value="slack" />
Slack
</label>
</CheckboxGroup>Examples
Nested Parent
import { Checkbox } from "@/components/ui/checkbox";
import { CheckboxGroup } from "@/components/ui/checkbox-group";
const permissions = [
{ label: "Read repositories", value: "read" },
{ label: "Write deployments", value: "write" },
{ label: "Manage billing", value: "billing" },
];
export default function Particle() {
return (
<CheckboxGroup
allValues={permissions.map((item) => item.value)}
defaultValue={["read"]}
>
<label className="inline-flex cursor-pointer select-none items-center gap-2.5 text-foreground text-sm leading-5">
<Checkbox parent />
Workspace permissions
</label>
{permissions.map((permission) => (
<label
className="inline-flex cursor-pointer select-none items-center gap-2.5 text-foreground text-sm leading-5"
key={permission.value}
>
<Checkbox value={permission.value} />
{permission.label}
</label>
))}
</CheckboxGroup>
);
}
API Reference
CheckboxGroup
Wraps Base UI CheckboxGroup. When a child label contains <Checkbox parent />, sibling items are automatically indented with subtle tree connector lines.
| Prop | Type | Default | Description |
|---|---|---|---|
value | string[] | - | Controlled array of checked values |
defaultValue | string[] | [] | Initial uncontrolled array of checked values |
onValueChange | (value: string[]) => void | - | Called when the group selection changes |
allValues | string[] | - | Full list of values required when using parent |
disabled | boolean | false | Disables all checkboxes inside the group |
className | string | - | Additional CSS classes |