Cnippet

Toggle Group

Buttons

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 {
  AlignCenterIcon,
  AlignLeftIcon,
  AlignRightIcon,
  MenuIcon,
} from "lucide-react";
import {
  ToggleGroup,
  ToggleGroupItem,
} from "@/components/ui/cnippet-toggle-group";

export default function ToggleGroupAlignment() {
  return (
    <ToggleGroup defaultValue={["left"]}>
      <ToggleGroupItem aria-label="Align left" value="left">
        <AlignLeftIcon />
      </ToggleGroupItem>
      <ToggleGroupItem aria-label="Align center" value="center">
        <AlignCenterIcon />
      </ToggleGroupItem>
      <ToggleGroupItem aria-label="Align right" value="right">
        <AlignRightIcon />
      </ToggleGroupItem>
      <ToggleGroupItem aria-label="Justify" value="justify">
        <MenuIcon />
      </ToggleGroupItem>
    </ToggleGroup>
  );
}

Dependencies

More by Cnippet

View all
  • Team

    Team

    1.3K
  • Davincho Hero-1

    Davincho Hero-1

    689
  • Aero Hero-3

    Aero Hero-3

    584
  • Features

    Features

    516
  • Random Letter Swap Navigation

    Random Letter Swap Navigation

    506
  • Services with Animated Hover Modal

    Services with Animated Hover Modal

    471
  • Blogs

    Blogs

    398
  • Aero Hero-1

    Aero Hero-1

    364

More in Buttons

View all
  • Texture Button

    Texture Button

    98
  • Button

    Button

    34
  • HeroUI Button Group

    HeroUI Button Group

  • Button

    Button

    49
  • Eclipse Button

    Eclipse Button

    39
  • Base Button

    Base Button

    4
  • Button

    Button

  • App Store Button

    App Store Button

    463