---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Menu button

The button a menu opens from, shown as words, a workspace's tile or an icon, for React and Tailwind CSS. Free, MIT.

Free. Its export: `MenuButton`.

## Try it

Open a menu button by click, Enter or the down arrow. In the workspace look switch to another workspace (the button and the page under it follow), or sign out and in again; Look also shows a view’s heading, the tools pill (turn tools on and off), the help disc and the ellipsis of more actions at two sizes.

The workspaces, the sign-in and every row are our own sample: nothing is signed out of, and a picked row is only written down.

## When to use

- The button a menu opens from, shown as words, a workspace's tile or an icon.
- Also called: dropdown button.

## When not to use

- Use it as the trigger of a DropdownMenu.

## 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 Menu button on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-menu-button
```

```text
Add the Goop Menu button to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { MenuButton, MenuButtonAvatar, MenuButtonLabel, MenuButtonIcon } from '@/components/ui/goop/menu-button';
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@/components/ui/goop/dropdown-menu';

<DropdownMenu>
  <DropdownMenuTrigger asChild>
    <MenuButton>
      <MenuButtonLabel>Workspace</MenuButtonLabel>
    </MenuButton>
  </DropdownMenuTrigger>
  <DropdownMenuContent aria-label="Workspace">
    <DropdownMenuItem>Workspace settings</DropdownMenuItem>
    <DropdownMenuItem>Log out</DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>
```

- Fits: list, record: toolbar.
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `shape: rounded | pill | circle | icon = pill`
- `size: sm | md | lg = md`
- `aria-label?: string` — The button's name for assistive technology: required on the help disc and the icon shape, which hold no words.
- `asChild?: boolean = false`
- `type?: 'button' | 'submit' | 'reset'`
- `onClick?: (event: MouseEvent) => void`
- `disabled?: boolean`

### Parts

- `MenuButtonAvatar` — The workspace's (or a person's) tile; also takes name?: string; hue?: AvatarHue; fill?: string; status?: 'online' | 'away' | 'busy' | 'offline'; statusLabel?: string
- `MenuButtonLabel` — The button's words where they carry their own type
- `MenuButtonIcon` — An icon before the words; className?: string — Classes added to the glyph's holder; its box and ink are already set; icon: IconName — A pack icon name

- Class recipes (cva): menuButtonVariants (MenuButton)
- data-slot values (to select a part by): menu-button, menu-button-icon, menu-button-indicator, menu-button-label

## Keyboard

- Enter: open the menu
- ArrowDown: open the menu

## Accessibility

- The native element answers the keyboard.
- hover, active, focus, focus-visible: the browser's own (:hover, :active, :focus, :focus-visible): write nothing
- expanded: the attribute data-state=open
- open: the attribute data-state=open
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## 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.

## Related

- [Dropdown menu](/themes/trail/components/dropdown-menu): A menu of actions.
- [Color mode toggle](/themes/trail/components/color-mode-toggle): The app's switch between light and dark, as a button or a menu.
- [Copy button](/themes/trail/components/copy-button): A button that copies a value such as a link, a key or a command to the clipboard and says it was copied in place.
- [Link](/themes/trail/components/link): A text link to another page or place, in running text or on its own.
