Atomx Docs
Components

Toggle Group

A set of two-state buttons that can be toggled on or off, sharing variants with Toggle.

Install

npx shadcn@latest add https://atomx.acau.net/r/toggle-group.json

Toggle Group depends on the Toggle registry item for its shared variants; shadcn add installs both automatically.

Usage

Use type="single" for a one-of-N selection (like a radio group of icon buttons) or type="multiple" for an N-of-N selection. Each ToggleGroupItem needs a unique value.

<ToggleGroup type="single" defaultValue="bold">
  <ToggleGroupItem value="bold" aria-label="Bold">
    <Bold />
  </ToggleGroupItem>
  <ToggleGroupItem value="italic" aria-label="Italic">
    <Italic />
  </ToggleGroupItem>
  <ToggleGroupItem value="underline" aria-label="Underline">
    <Underline />
  </ToggleGroupItem>
</ToggleGroup>

Preview

Single selection

Multiple selection, outline variant

Props

ToggleGroup extends React.ComponentProps<typeof ToggleGroupPrimitive.Root> and VariantProps<typeof toggleVariants>.

PropTypeNotes
type"single" | "multiple"Selection mode. Required.
valuestring | string[]Controlled selected value(s).
defaultValuestring | string[]Initial value when uncontrolled.
onValueChange(value) => voidFired when selection changes.
variant"default" | "outline"Applied to all items unless overridden.
size"default" | "sm" | "lg"Applied to all items unless overridden.
disabledbooleanDisables every item.

ToggleGroupItem extends React.ComponentProps<typeof ToggleGroupPrimitive.Item> and VariantProps<typeof toggleVariants>.

PropTypeNotes
valuestringRequired. Identifies the item within the group.
disabledbooleanDisables just this item.
variant"default" | "outline"Overrides the group's variant for this item.
size"default" | "sm" | "lg"Overrides the group's size for this item.