Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-button-group.json --yes

Button group

Pro

Joined buttons, and a SplitButton: a main action with its menu, for React and Tailwind CSS. Part of Goop Pro.

Press the split button or open its menu (pointer or keyboard), switch its look and size, make it busy or disabled; page the week and stack the group of three. The line under them says what ran. Nothing is saved: each press only says what it would do.

When to use

  • Joined buttons, and a SplitButton: a main action with its menu.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Button group on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-button-group.json --yes
PROMPT
Add the Goop Button group to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { ButtonGroup, SplitButton } from '@/components/ui/goop/button-group';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { Button } from '@/components/ui/goop/button';
import { DropdownMenuItem } from '@/components/ui/goop/dropdown-menu';

function SaveActions({ save, saving }: { save: () => void; saving: boolean }) {
  return (
    <div className="flex items-center gap-2">
      <ButtonGroup aria-label="Week">
        <IconButton variant="outline" aria-label="Previous week">
          <IconButtonIcon icon="chevron-left" />
        </IconButton>
        <Button variant="outline">Today</Button>
        <IconButton variant="outline" aria-label="Next week">
          <IconButtonIcon icon="chevron-right" />
        </IconButton>
      </ButtonGroup>
      <SplitButton
        onClick={save}
        loading={saving}
        menu={
          <>
            <DropdownMenuItem>Save as draft</DropdownMenuItem>
            <DropdownMenuItem>Save and share with the team</DropdownMenuItem>
          </>
        }
      >
        Save note
      </SplitButton>
    </div>
  );
}
  • Fits: record, list: header.
  • Also known as: ButtonBar, ActionGroup, AttachedButtons, JoinedButtons, DropdownButton, ButtonWithMenu.
  • height, width, corner, border: add no class for these.

API reference

Options
OptionTypeWhat it does
orientationhorizontal | vertical = horizontal
aria-label?stringWhat the group is, said to a reader (aria-label); or name it with aria-labelledby.
Parts
PartWhat it is
SplitButtonA main action with a menu of related ones beside it ("Save", then "Save as draft"); children: ReactNode — The main button's words; onClick?: ComponentProps<typeof Button>['onClick'] — The main action, run by the main half; menu: ReactNode — The menu's rows (DropdownMenuItems), opened by the chevron; menuLabel?: string — What the chevron is called (its aria-label and tooltip); variant?: 'primary' | 'outline' = 'primary' — primary the accent fill, outline the surface on its ring; size?: 'sm' | 'md' | 'lg' = 'md' — The height: sm 24, md 28, lg 32 px; loading?: boolean = false — The main action is running: the spinner on the main half alone; the menu stays usable; loadingLabel?: string — What a reader hears beside the main words while loading (default "Loading"); disabled?: boolean = false — Both halves cannot act now; open?: boolean — The menu's open state, when you hold it; with onOpenChange; defaultOpen?: boolean — Whether the menu starts open, when it holds its own state; onOpenChange?: (open: boolean) => void — Called with the menu's next open state; modal?: boolean — Whether the open menu holds the page (the default): no pointer outside it, the focus kept in it; container?: ComponentProps<typeof DropdownMenuContent>['container'] — Where the menu is portalled (default the page's body); also takes type?: 'button' | 'submit' | 'reset'
  • Class recipes (cva): buttonGroupVariants (ButtonGroup)
  • data-slot values (to select a part by): button-group, split-button

Keyboard

KeyWhat it does
TabMove to the next member: each button is its own tab stop
EnterRun the focused member's action; on the split button's chevron open its menu
SpaceRun the focused member's action; on the split button's chevron open its menu
ArrowDownOn the split button's chevron open its menu with its first row active
EscapeClose the split button's menu and give the focus back to the chevron

Accessibility

  • The part itself answers the keys above.
  • hover, focus-visible: the browser's own (:hover, :focus-visible): write nothing

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/trail/components/button-group.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-button-group.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.