adn-ui
Components

Toggle Group

A high-quality, styled React toggle group component built with @base-ui/react for button groups.

The ToggleGroup component organizes multiple Toggle controls into a single managed group supporting single or multi-selection.

Usage

import { Toggle } from "@/components/ui/toggle";
import { ToggleGroup } from "@/components/ui/toggle-group";

export function ExampleToggleGroup() {
  return (
    <ToggleGroup.Root defaultValue={["bold"]} multiple>
      <Toggle.Root value="bold">Bold</Toggle.Root>
      <Toggle.Root value="italic">Italic</Toggle.Root>
      <Toggle.Root value="underline">Underline</Toggle.Root>
    </ToggleGroup.Root>
  );
}

Preview

Custom Styling

Apply custom group spacing, borders, or shadow containers via className:

<ToggleGroup.Root className="bg-slate-900 border border-slate-800 p-1 rounded-xl gap-1">
  <Toggle.Root value="left" className="data-[pressed]:bg-indigo-600 data-[pressed]:text-white">Left</Toggle.Root>
</ToggleGroup.Root>

Styling & Class Names

Target internal toggle group CSS slots for custom overrides:

Class NameElement / SlotDescription
.toggle-groupRoot containerMain toggle group flex row container.

Anatomy

import { Toggle } from "@base-ui/react/toggle";
import { ToggleGroup } from "@base-ui/react/toggle-group";

<ToggleGroup>
  <Toggle value="1" />
  <Toggle value="2" />
</ToggleGroup>;

API Reference

ToggleGroup.Root Props

PropTypeDefaultDescription
valuestring[]undefinedControlled array of pressed toggle values.
defaultValuestring[]undefinedInitial uncontrolled array of pressed toggle values.
multiplebooleanfalseWhen true, multiple items in the group can be pressed simultaneously.
orientation'horizontal' | 'vertical''horizontal'Layout direction of the toggle button group.
disabledbooleanfalseDisables user interaction for all toggles in the group.

On this page