---
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/"
---

# Sidebar menu button

One row of the sidebar, its icon and words, that opens a page or runs an action and shows which page is current, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `SidebarMenuButton`.

## Try it

Press a row to make it the active one; switch the size, the icons, the count and long words.

The rows go nowhere: a press only moves the active row.

## When to use

- One row of the sidebar, its icon and words, that opens a page or runs an action and shows which page is current.

## 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 Sidebar menu button 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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-sidebar-menu-button.json --yes
```

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

## Usage

```tsx
import { SidebarMenuButton, SidebarMenuBadge } from '@/components/ui/goop/sidebar-menu-button';
import { SidebarMenu, SidebarMenuItem } from '@/components/ui/goop/sidebar-group';

<SidebarMenu>
  <SidebarMenuItem>
    <SidebarMenuButton icon="plus" onClick={openCreate}>
      New issue
    </SidebarMenuButton>
  </SidebarMenuItem>
  <SidebarMenuItem>
    <SidebarMenuButton asChild icon="inbox" isActive>
      <RouterLink href="/inbox">Inbox</RouterLink>
    </SidebarMenuButton>
  </SidebarMenuItem>
</SidebarMenu>
```

- Fits: chat, frame, inbox (their recipes).
- height, width, padding, corner, text: add no class for these.

## API reference

### Options

- `size?: 'sm' | 'md' = 'md'` — `md` the settings sidebar's row, `sm` the main sidebar's: the Link's two nav sizes.
- `onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>` — The row's press: on a link row as on any link; with no `href` (and no `asChild`) the row is a button that fires it.
- `icon?: IconName` — The glyph before the words, by the pack's name; left out, the row draws no glyph.
- `isActive?: boolean = false` — The current page: the row keeps the deeper fill and the dark words.
- `asChild?: boolean = false`
- `href?: string`

- Takes every prop of Link but variant and mark (its page: link.md)

### Parts

- `SidebarMenuBadge` — A row's trailing count (`<SidebarMenuBadge>3</SidebarMenuBadge>`, the row's last child)

- data-slot values (to select a part by): sidebar-menu-badge, sidebar-menu-button, sidebar-menu-button-arrow, sidebar-menu-button-icon, sidebar-menu-button-label

## Keyboard

- Enter: follow

## Accessibility

- The native element answers the keyboard.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
- current: the attribute aria-current=page

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

- [Sidebar group](/themes/trail/components/sidebar-group): A titled group of links in the sidebar, such as a team's pages or your projects, that can fold open and closed.
- [Top bar](/themes/trail/components/top-bar): The bar across the top of a page in the app frame, with its title, tabs and actions.
- [Page header](/themes/trail/components/page-header): The title block that opens a page, with its page-level actions.
- [Section header](/themes/trail/components/section-header): The title row over one block inside a page, with an optional count, description and actions, such as a settings section.
