Components
A set of toggle buttons that work together as a single control, built on Base UI's ToggleGroup primitive. Supports single or multiple selection, horizontal and vertical orientation, default and outline variants with three sizes, and an optional ToggleGroupSeparator between items. The Toggle and Separator primitives are inlined so the component ships as a single self-contained file.
npx @21st-dev/cli add cnippet.dev/cnippet-toggle-groupLoading preview...
import { BoldIcon, ItalicIcon, UnderlineIcon } from "lucide-react";
import {
ToggleGroup,
ToggleGroupItem,
} from "@/components/ui/cnippet-toggle-group";
export default function ToggleGroupMultiple() {
return (
<ToggleGroup defaultValue={["bold"]} multiple>
<ToggleGroupItem aria-label="Toggle bold" value="bold">
<BoldIcon />
</ToggleGroupItem>
<ToggleGroupItem aria-label="Toggle italic" value="italic">
<ItalicIcon />
</ToggleGroupItem>
<ToggleGroupItem aria-label="Toggle underline" value="underline">
<UnderlineIcon />
</ToggleGroupItem>
</ToggleGroup>
);
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...