Toggle Group

A set of toggle buttons that work together, supporting single or multiple selection modes.

ui@radix-ui/react-toggle-groupclass-variance-authority

Installation

$npx futureuikit add toggle-group

Import

import { ToggleGroup } from "@/components/ui/toggle-group"
Layout Variant
Color Theme
Shape
Size
Spacing / Padding

Named Keys & Props

Pass these exact named keys as props on <ToggleGroup />. Click any color pill to copy the prop.

colorDefault is "default"(Black & White)
variantVisual style
"solid""outline""ghost""glass""elevated""soft"
shapeCorner shape
"default""square""rounded""sharp""pill"
spacingInner spacing
"default""2x""4x""6x""8x"
sizeComponent size
"default""sm""md""lg""xl"

Usage Example

A basic implementation example to get you started.

Example Implementation
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";

export default function Example() {
  return (
    <ToggleGroup type="single">
      <ToggleGroupItem value="a">A</ToggleGroupItem>
      <ToggleGroupItem value="b">B</ToggleGroupItem>
      <ToggleGroupItem value="c">C</ToggleGroupItem>
    </ToggleGroup>
  );
}

Features

Key capabilities and highlights.

Key Capabilities
  • ◆Supports single and multiple selection via the type prop.
  • ◆Built on Radix UI for consistent accessibility.
  • ◆Easily styled toggle items with active/inactive states.

Notes

Important implementation details to consider.

Implementation Details
  • ◆Install: Run 'npx futureuikit add toggle-group'.
  • ◆Import: 'import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";'
  • ◆Usage: Set type to 'single' or 'multiple' and nest ToggleGroupItem elements.