Cnippet

Toggle Group

Buttons 2

About

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.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Toggle Group to your project and fits it to your theme.

Code

How Toggle Group is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { Columns2Icon, LayoutGridIcon, ListIcon } from "lucide-react";
import {
  ToggleGroup,
  ToggleGroupItem,
} from "@/components/ui/cnippet-toggle-group";

export default function ToggleGroupViewSwitch() {
  return (
    <ToggleGroup defaultValue={["list"]} variant="outline">
      <ToggleGroupItem aria-label="List view" value="list">
        <ListIcon />
      </ToggleGroupItem>
      <ToggleGroupItem aria-label="Grid view" value="grid">
        <LayoutGridIcon />
      </ToggleGroupItem>
      <ToggleGroupItem aria-label="Kanban view" value="kanban">
        <Columns2Icon />
      </ToggleGroupItem>
    </ToggleGroup>
  );
}

Dependencies

More by Cnippet

View all
  • Team

    Team

    1.4K
  • Davincho Hero-1

    Davincho Hero-1

    719
  • Aero Hero-3

    Aero Hero-3

    638
  • Random Letter Swap Navigation

    Random Letter Swap Navigation

    602
  • Features

    Features

    542
  • Services with Animated Hover Modal

    Services with Animated Hover Modal

    496
  • Text Reveal

    Text Reveal

    407
  • Blogs

    Blogs

    407

More in Buttons

View all
  • Button

    Button

    166
  • Texture Button

    Texture Button

    121
  • Button

    Button

    21
  • Figma File Button

    Figma File Button

    39
  • Native Button

    Native Button

    12
  • Button

    Button

    88
  • HeroUI Button Group

    HeroUI Button Group

    11
  • Great UI Button

    Great UI Button

    19