npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-button-group.json --yesButton group
ProJoined buttons, and a SplitButton: a main action with its menu, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- SplitButtonA main action with a menu of related ones beside it ("Save", then "Save as draft")
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>
);
}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.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-button-group.json --yesAdd the Goop Button group to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
| Option | Type | What it does |
|---|---|---|
| orientation | horizontal | vertical = horizontal | |
| aria-label? | string | What the group is, said to a reader (aria-label); or name it with aria-labelledby. |
| Part | What it is |
|---|---|
| SplitButton | A 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
| Key | What it does |
|---|---|
| Tab | Move to the next member: each button is its own tab stop |
| Enter | Run the focused member's action; on the split button's chevron open its menu |
| Space | Run the focused member's action; on the split button's chevron open its menu |
| ArrowDown | On the split button's chevron open its menu with its first row active |
| Escape | Close 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.