---
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>/meadow-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 { SidebarMenu, SidebarMenuItem } from '@/components/ui/goop/sidebar-group';
import { SidebarMenuBadge, SidebarMenuButton } from '@/components/ui/goop/sidebar-menu-button';

function FieldworkNav({ onSearch, onLogOut }: { onSearch: () => void; onLogOut: () => void }) {
  return (
    <SidebarMenu aria-label="Fieldwork">
      <SidebarMenuItem>
        <SidebarMenuButton href="/notes" icon="file-text" isActive>
          Notes
          <SidebarMenuBadge>12</SidebarMenuBadge>
        </SidebarMenuButton>
      </SidebarMenuItem>
      <SidebarMenuItem>
        <SidebarMenuButton href="/calendar" icon="calendar">
          Calendar
        </SidebarMenuButton>
      </SidebarMenuItem>
      <SidebarMenuItem>
        <SidebarMenuButton icon="search" onClick={onSearch}>
          Search
        </SidebarMenuButton>
      </SidebarMenuItem>
      <SidebarMenuItem>
        <SidebarMenuButton tone="danger" icon="tabler-outline:logout" onClick={onLogOut}>
          Log out
        </SidebarMenuButton>
      </SidebarMenuItem>
    </SidebarMenu>
  );
}
```

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

## API reference

### Options

- `size?: 'md' | 'sm' | 'lg' = 'md'`
- `tone?: 'default' | 'danger' = 'default'` — `default` the grey row; `danger` the red row (red words and glyph, a pale red wash under the pointer).
- `asChild?: boolean = false` — Draw the row on the caller's one element (a router's own link) instead of an `a`.
- `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 accent wash.
- `arrow?: 'up-right' | 'right'` — The pack's arrow after the words: `up-right` (a page that leaves the app) or `right` (a page of the app).
- `href?: string`

### 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, sidebar-menu-button-text

## Keyboard

- Enter: follow

## Accessibility

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

## 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/meadow/components/sidebar-group): A titled group of links in the sidebar, such as the notes of a day or your projects, that can fold open and closed.
- [Top bar](/themes/meadow/components/top-bar): The bar across the top of a page, with its breadcrumbs and title at its start and its page-level controls at its end.
- [Page header](/themes/meadow/components/page-header): The title block that opens a page, with its page-level actions.
- [Section header](/themes/meadow/components/section-header): The title row over one block inside a page, with an optional count, description and actions, such as a settings section.
