Group-tone button

Group-tone is a set of five attached button groups (Info, Success, Warning, Danger, Muted) that share one structure and differ only in colour tone. Each group uses semantic ai2 colour tokens with color-mix alpha, and its first button shows a tone icon.

componentstyledbuttonregistry-item.json
Group-tone button
LIVE · running in a sandboxed iframe
Installed with shadcn add · 2 workarounds · theme from registry.json
  • applied the registry's theme (tokens, fonts and CSS from the registry preview settings)
  • installed base item https://ai2.design/r/tokens.json (registry preview settings)
See how it was built

Installation

pnpm dlx shadcn@latest add @ai2/button-group-tone

Requires @ai2 in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { InfoButtonGroup } from "@/components/ui/button-group-tone"export default function Example() {  return <InfoButtonGroup size="md" />}
  • Showing a row of related actions (for example View, Edit, Share) that should read as one connected control with a clear status tone.
  • Signalling intent through colour: Info for neutral information, Success for confirmations, Warning for caution, Danger for destructive actions.
  • Adding a quiet secondary action row with the Muted variant where a loud tone would compete with the page content.
  • Building toolbars or card footers that need a consistent, token-driven look across light and dark themes.

Examples

Default info group

Renders the Info tone with the three default actions (View, Edit, Share) at the default md size.

default-info-group.tsx
import { InfoButtonGroup } from "@/components/ui/button-group-tone"export default function DefaultInfo() {  return <InfoButtonGroup />}

Danger group with custom actions

Passes its own actions array. The first action uses an explicit icon and onClick handler, and the group uses the xl size.

danger-group-with-custom-actions.tsx
import { Trash2, Archive } from "lucide-react"import { DangerButtonGroup } from "@/components/ui/button-group-tone"export default function DeleteActions() {  return (    <DangerButtonGroup      size="xl"      actions={[        { label: "Delete", icon: <Trash2 />, onClick: () => console.log("delete") },        { label: "Archive", icon: <Archive />, onClick: () => console.log("archive") },      ]}    />  )}

Muted toolbar group

Places a small Muted group at the end of a toolbar using className for layout.

muted-toolbar-group.tsx
import { MutedButtonGroup } from "@/components/ui/button-group-tone"export default function Toolbar() {  return (    <div className="flex items-center gap-2">      <span className="text-sm">3 selected</span>      <MutedButtonGroup        size="sm"        className="ml-auto"        actions={[{ label: "Copy" }, { label: "Move" }]}      />    </div>  )}

API reference

PropTypeDefaultDescription
classNamestring—Extra classes merged onto the outer role="group" wrapper (inline-flex isolate) via cn().
sizeStyledSize ("sm" | "md" | "lg" | "xl")"md"Height and padding of every button in the group: sm h-8 px-3 text-sm, md h-9 px-4 text-sm, lg h-10 px-5 text-sm, xl h-12 px-6 text-base.
actionsAction[][{ label: "View" }, { label: "Edit" }, { label: "Share" }]Buttons to render, in order. Each Action has optional label (React.ReactNode), icon (React.ReactNode) and onClick (() => void). The first button falls back to the tone icon when no icon is given; other buttons render only their own icon.

Accessibility

  • Each group is a div with role="group", and its aria-label is fixed per tone: "Info actions", "Success actions", "Warning actions", "Danger actions" or "Muted actions". The aria-label cannot be changed through props, so wrap the group in a labelled container if a more specific name is needed.
  • Every action renders a native type="button", so it is keyboard focusable and activates with Enter and Space.
  • Focus is shown with focus-visible:ring-[3px] and focus-visible:ring-ring/50, and focused items raise z-index so the ring is not clipped by neighbours.
  • Decorative icons are wrapped with pointer-events-none and are not given aria-hidden, so buttons without a visible text label should get an accessible name through a wrapping element or aria-label on the group.
  • Tone is conveyed by colour and by the leading icon. Do not rely on colour alone: keep the label text meaningful, for example 'Delete' rather than only a red button.
  • Disabled state is not a prop. Adding a disabled attribute directly is not supported by the actions type, so disable the actions in the surrounding logic instead.
  • Text colours are semantic tokens, so check contrast for the chosen theme when using the Warning amber tone on light backgrounds.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Group-tone button" component (ai2/button-group-tone) from its shadcn registry.1. Install it with: npx shadcn@latest add @ai2/button-group-tone2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: className, size, actions.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { InfoButtonGroup } from "@/components/ui/button-group-tone"export default function Example() {  return <InfoButtonGroup size="md" />}```

Files & dependencies

  • registry/ai2/styled/button-group-tone.tsx→ components/ui/button-group-tone.tsx
dependencieslucide-react@^1.23.0
registryDependencies@ai2/tokens

Looks similar, elsewhere