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

A titled group of links in the sidebar, such as a team's pages or your projects, that can fold open and closed, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `SidebarGroup`.

## Try it: sidebar-group

Fold and unfold each group by its label (click, Enter or Space); press + to add a favourite (the group opens to show it); press a row to make it the current page.

The pages are our own sample; nothing opens.

## Try it: sidebar-group-dismiss

Dismiss the starter steps by their crosses (shown under the pointer or the keyboard): the focus moves on to the next row, the group goes with the last one, and a button brings them all back.

The steps lead nowhere; dismissing only hides them in the page.

## When to use

- A titled group of links in the sidebar, such as a team's pages or your projects, that can fold open and closed.

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

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

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

## Usage

```tsx
import { SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarGroupAction, SidebarMenu, SidebarMenuItem, SidebarMenuAction } from '@/components/ui/goop/sidebar-group';
import { SidebarMenuButton } from '@/components/ui/goop/sidebar-menu-button';

<SidebarGroup>
  <SidebarGroupLabel>Workspace</SidebarGroupLabel>
  <SidebarGroupContent>
    <SidebarMenu>
      <SidebarMenuItem>
        <SidebarMenuButton href="/inbox" icon="inbox" isActive>
          Inbox
        </SidebarMenuButton>
      </SidebarMenuItem>
      <SidebarMenuItem>
        <SidebarMenuButton href="/drafts" icon="file">
          Drafts
        </SidebarMenuButton>
      </SidebarMenuItem>
    </SidebarMenu>
  </SidebarGroupContent>
</SidebarGroup>
```

- Fits: chat, frame, inbox (their recipes).
- Also known as: SidebarMenu, SidebarMenuItem.
- height, width, padding, gap, corner, background, text, motion: add no class for these.

## API reference

### Options

- `collapsible?: boolean = false` — Fold the section from its label: the main sidebar's section.
- `variant?: 'default' | 'item' = 'default'` — A folding group's look: `default` the main sidebar's section, `item` a team's section.
- `defaultOpen?: boolean = true` — Whether a folding group starts open, when the group holds it.
- `open?: boolean` — Whether a folding group is open, when the caller holds it; with `onOpenChange`.
- `onOpenChange?: (open: boolean) => void` — Called with the new open state when a person folds or unfolds the group from its label.

- State: open (open / defaultOpen / onOpenChange); drawn by data-state=open

### Parts

- `SidebarGroupLabel` — The group's name over its rows; in a collapsible group it is the button that folds them; its props: sidebar-group--label.md
- `SidebarGroupContent` — Holds the group's rows, a SidebarMenu, under the label; in a collapsible group this is what folds
- `SidebarGroupAction` — A folding section's trailing action, in its label; icon: IconName — The glyph, by the pack's name: the section's plus is `plus`; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; aria-label: string; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'
- `SidebarMenu` — The list of rows
- `SidebarMenuItem` — One row of a SidebarMenu; put a SidebarMenuButton in it, then an optional SidebarMenuAction
- `SidebarMenuAction` — A row's dismiss control, after its `SidebarMenuButton` in the same `SidebarMenuItem`; icon: IconName — The glyph, by the pack's name: the row's cross is `x`; also takes type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; aria-label: string; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'

- data-slot values (to select a part by): sidebar-group, sidebar-group-action, sidebar-group-content, sidebar-group-label, sidebar-group-label-icon, sidebar-group-label-text, sidebar-group-rail-button, sidebar-group-rail-mark, sidebar-menu, sidebar-menu-action, sidebar-menu-item

### SidebarGroupLabel

The group's name over its rows; in a collapsible group it is the button that folds them.

```tsx
import { SidebarGroupLabel } from '@/components/ui/goop/sidebar-group';
```

### Options

- ref?: Ref<HTMLElement> — The label's element: the heading, or in a folding group the trigger.
- mark?: ReactNode — A leading glyph before the words, in a 14 px box (a team's mark): the caller's one element.
- action?: ReactNode — A control at the end of a folding group's label: a `SidebarGroupAction`, or a `CollapsibleAction` in a team's section.
- headingLevel?: 2 | 3 | 4 | 5 | 6 = 2 — A static label's heading level: 2; a folding group's label is its trigger, no heading.

## Accessibility

- hover, active, focus-within: the browser's own (:hover, :active, :focus-within): write nothing
- expanded: the attribute data-state=open
- open: the attribute data-state=open

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

- [Sidebar menu button](/themes/trail/components/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.
- [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.
