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 {
ToggleGroup,
ToggleGroupItem,
} from "@/components/ui/cnippet-toggle-group";
export default function ToggleGroupOutline() {
return (
<div className="flex flex-col items-center justify-center gap-4">
<ToggleGroup defaultValue={["top"]} size="sm" variant="outline">
<ToggleGroupItem value="top">Top</ToggleGroupItem>
<ToggleGroupItem value="bottom">Bottom</ToggleGroupItem>
</ToggleGroup>
<ToggleGroup defaultValue={["top"]} variant="outline">
<ToggleGroupItem value="top">Top</ToggleGroupItem>
<ToggleGroupItem value="bottom">Bottom</ToggleGroupItem>
</ToggleGroup>
</div>
);
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...