Search

Search documentation

Toggle Group

A set of two-state buttons that can be toggled on or off.

Installation

pnpm dlx shadcn@latest add @evolphin/toggle-group

Usage

import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
<ToggleGroup type="single">
  <ToggleGroupItem value="a">A</ToggleGroupItem>
  <ToggleGroupItem value="b">B</ToggleGroupItem>
  <ToggleGroupItem value="c">C</ToggleGroupItem>
</ToggleGroup>

Type Definitions

interface ToggleGroupProps {
  /** The type of toggle group */
  type: "single" | "multiple";
ToggleGroupProps.type: "single" | "multiple"

The type of toggle group

/** The visual style of the toggle group */ ?: "default" | "outline"; /** The size of the toggle group */ ?: "default" | "sm" | "lg"; }

Examples

Default

Outline

Single Select

Large

API Reference

ToggleGroup

PropTypeDefaultDescription
type`"single" \"multiple"`"single"
variant`"default" \"outline"`"default"
size`"default" \"sm" \"lg"`
value`string \string[]`-
onValueChange`(value: string \string[]) => void`-
disabledbooleanfalseWhether the toggle group is disabled.
classNamestring-Additional CSS classes

ToggleGroupItem

PropTypeDefaultDescription
valuestring-The value of the item.
disabledbooleanfalseWhether the item is disabled.
aria-labelstring-Accessibility label for the item.
classNamestring-Additional CSS classes

On this page