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 ToggleGroupBilling() {
return (
<ToggleGroup defaultValue={["monthly"]} size="lg" variant="outline">
<ToggleGroupItem value="monthly">Monthly</ToggleGroupItem>
<ToggleGroupItem className="gap-2" value="yearly">
Yearly
<span className="rounded-full bg-primary px-2 py-0.5 font-medium text-primary-foreground text-xs">
Save 20%
</span>
</ToggleGroupItem>
</ToggleGroup>
);
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...