npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-sidebar.json --yesSidebar
ProThe app's main navigation down one side of the window, for React and Tailwind CSS. Part of Goop Pro.
Sidebar
What an agent sees
- SidebarProviderHolds the sidebar's rail state for what is outside the
nav - SidebarScopeWhere the sidebar's parts stand outside the sidebar, beside it (a settings page's section navigation of
SidebarGrouprows) - SidebarRailThe sidebar's rail, the column of the app's sections that stays beside its panel and is all that shows collapsed (
<Sidebar><SidebarRail>…</SidebarRail><SidebarHeader>…</SidebarHeader><SidebarContent>…</SidebarContent></Sidebar>) - SidebarHeaderThe region at the top, which never scrolls
- SidebarHeaderRowThe header's row of controls
- SidebarTitleThe column's name in the header row (
<SidebarTitle>Notes</SidebarTitle>before theSidebarRailToggle) - SidebarContentThe column of groups, which scrolls under the header
- SidebarFooterThe region at the foot, which never scrolls
- SidebarRailToggleits props: sidebar--rail-toggle.md
- useSidebarThe sidebar's rail state, for a part of the caller's own inside it (
const { open } = useSidebar())
import { SidebarProvider, SidebarScope, useSidebar, SidebarFooter } from '@/components/ui/goop/sidebar';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { Link } from '@/components/ui/goop/link';
import {
Sidebar,
SidebarContent,
SidebarHeader,
SidebarHeaderRow,
SidebarRail,
SidebarRailToggle,
SidebarTitle,
} from '@/components/ui/goop/sidebar';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/goop/tooltip';
function AppSidebar() {
return (
<Sidebar aria-label="Main" storageKey="sidebar:collapsed">
<SidebarRail>
<SidebarRailToggle />
<hr />
<Tooltip>
<TooltipTrigger asChild>
<IconButton asChild size="lg" aria-label="Notes">
<a href="/notes" aria-current="page">
<IconButtonIcon icon="file-text" />
</a>
</IconButton>
</TooltipTrigger>
<TooltipContent side="right">Notes</TooltipContent>
</Tooltip>
</SidebarRail>
<SidebarHeader>
<SidebarHeaderRow>
<SidebarTitle>Notes</SidebarTitle>
<SidebarRailToggle />
</SidebarHeaderRow>
</SidebarHeader>
<SidebarContent>
<Link href="/notes/north-field" className="w-full">
Survey
</Link>
<Link href="/notes/permits" className="w-full">
Drainage permit
</Link>
</SidebarContent>
</Sidebar>
);
}Press a row (or Tab to it and press Enter) to switch the page beside it; read the inbox’s notices and its count goes down; switch the workspace from the menu at the top; collapse the sidebar to its rail of icons with the toggle or ⌘B / Ctrl+B and hover a row for its name; on a phone-sized window open it from the top bar’s button. In a theme whose frame is the icon rail (Meadow), the sidebar is that rail beside a panel of the day’s notes: the rail’s icons switch the section, its plus adds a note, and the same toggle and keys collapse it to the rail alone. The pages, the notes, the workspaces and the person are our own sample, and signing out does nothing.
Sidebar settings
What an agent sees
- SidebarProviderHolds the sidebar's rail state for what is outside the
nav - SidebarScopeWhere the sidebar's parts stand outside the sidebar, beside it (a settings page's section navigation of
SidebarGrouprows) - SidebarRailThe sidebar's rail, the column of the app's sections that stays beside its panel and is all that shows collapsed (
<Sidebar><SidebarRail>…</SidebarRail><SidebarHeader>…</SidebarHeader><SidebarContent>…</SidebarContent></Sidebar>) - SidebarHeaderThe region at the top, which never scrolls
- SidebarHeaderRowThe header's row of controls
- SidebarTitleThe column's name in the header row (
<SidebarTitle>Notes</SidebarTitle>before theSidebarRailToggle) - SidebarContentThe column of groups, which scrolls under the header
- SidebarFooterThe region at the foot, which never scrolls
- SidebarRailToggleits props: sidebar--rail-toggle.md
- useSidebarThe sidebar's rail state, for a part of the caller's own inside it (
const { open } = useSidebar())
import { SidebarProvider, SidebarScope, useSidebar, SidebarFooter } from '@/components/ui/goop/sidebar';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { Link } from '@/components/ui/goop/link';
import {
Sidebar,
SidebarContent,
SidebarHeader,
SidebarHeaderRow,
SidebarRail,
SidebarRailToggle,
SidebarTitle,
} from '@/components/ui/goop/sidebar';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/goop/tooltip';
function AppSidebar() {
return (
<Sidebar aria-label="Main" storageKey="sidebar:collapsed">
<SidebarRail>
<SidebarRailToggle />
<hr />
<Tooltip>
<TooltipTrigger asChild>
<IconButton asChild size="lg" aria-label="Notes">
<a href="/notes" aria-current="page">
<IconButtonIcon icon="file-text" />
</a>
</IconButton>
</TooltipTrigger>
<TooltipContent side="right">Notes</TooltipContent>
</Tooltip>
</SidebarRail>
<SidebarHeader>
<SidebarHeaderRow>
<SidebarTitle>Notes</SidebarTitle>
<SidebarRailToggle />
</SidebarHeaderRow>
</SidebarHeader>
<SidebarContent>
<Link href="/notes/north-field" className="w-full">
Survey
</Link>
<Link href="/notes/permits" className="w-full">
Drainage permit
</Link>
</SidebarContent>
</Sidebar>
);
}Press a row to switch the settings page beside it; type in the field to filter the rows (“mem”, “bill”); “Back to app” leaves settings, and a button brings you back. The pages are our own sample with a line each. The filter is this example’s: the settings sidebar’s field filters nothing by itself.
When to use
- The app's main navigation down one side of the window.
- Also called: side navigation or nav drawer.
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 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>/meadow-sidebar.json --yesAdd the Goop Sidebar to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { SidebarProvider, SidebarScope, useSidebar, SidebarFooter } from '@/components/ui/goop/sidebar';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { Link } from '@/components/ui/goop/link';
import {
Sidebar,
SidebarContent,
SidebarHeader,
SidebarHeaderRow,
SidebarRail,
SidebarRailToggle,
SidebarTitle,
} from '@/components/ui/goop/sidebar';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/goop/tooltip';
function AppSidebar() {
return (
<Sidebar aria-label="Main" storageKey="sidebar:collapsed">
<SidebarRail>
<SidebarRailToggle />
<hr />
<Tooltip>
<TooltipTrigger asChild>
<IconButton asChild size="lg" aria-label="Notes">
<a href="/notes" aria-current="page">
<IconButtonIcon icon="file-text" />
</a>
</IconButton>
</TooltipTrigger>
<TooltipContent side="right">Notes</TooltipContent>
</Tooltip>
</SidebarRail>
<SidebarHeader>
<SidebarHeaderRow>
<SidebarTitle>Notes</SidebarTitle>
<SidebarRailToggle />
</SidebarHeaderRow>
</SidebarHeader>
<SidebarContent>
<Link href="/notes/north-field" className="w-full">
Survey
</Link>
<Link href="/notes/permits" className="w-full">
Drainage permit
</Link>
</SidebarContent>
</Sidebar>
);
}- Fits: account, chat, inbox, settings (their recipes).
- height, width, padding, gap, corner, border, background, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | settings = default | |
| open? | boolean | Drawn as the open column (true) or the rail (false), when the caller holds it (with onOpenChange). |
| defaultOpen? | boolean = true | Whether it starts as the open column (true, the default) or the rail (false), when the sidebar holds it. |
| onOpenChange? | (open: boolean) => void | Called as it opens (true) or collapses to the rail (false): by its SidebarRailToggle, its key, or useSidebar().setCollapsed. |
| shortcut? | string | false = 'mod+b' | The key that switches it, mod+b by default (mod is ⌘ on an Apple keyboard, Ctrl elsewhere; shift and alt may join it); false for none. |
| storageKey? | string | Remembers the rail across a reload under this key in the page's local storage ("sidebar:collapsed"; give each sidebar its own). |
| container? | HTMLElement | null | Where a caller's rail tooltips are drawn (useSidebar().container); the end of <body> when left out. |
- State: open (open / defaultOpen / onOpenChange)
| Part | What it is |
|---|---|
| SidebarProvider | Holds the sidebar's rail state for what is outside the nav |
| SidebarScope | Where the sidebar's parts stand outside the sidebar, beside it (a settings page's section navigation of SidebarGroup rows) |
| SidebarRail | The sidebar's rail, the column of the app's sections that stays beside its panel and is all that shows collapsed (<Sidebar><SidebarRail>…</SidebarRail><SidebarHeader>…</SidebarHeader><SidebarContent>…</SidebarContent></Sidebar>) |
| SidebarHeader | The region at the top, which never scrolls |
| SidebarHeaderRow | The header's row of controls |
| SidebarTitle | The column's name in the header row (<SidebarTitle>Notes</SidebarTitle> before the SidebarRailToggle) |
| SidebarContent | The column of groups, which scrolls under the header; its end is its own |
| SidebarFooter | The region at the foot, which never scrolls |
| SidebarRailToggle | its props: sidebar--rail-toggle.md |
| useSidebar | The sidebar's rail state, for a part of the caller's own inside it (const { open } = useSidebar()) |
- Class recipes (cva): sidebarVariants (Sidebar)
SidebarRailToggle
import { SidebarRailToggle } from '@/components/ui/goop/sidebar';Options
- aria-label?: string — One spoken name in both states, instead of the two below.
- collapseLabel?: string = 'Collapse sidebar' — Its spoken name while the sidebar is open.
- expandLabel?: string = 'Expand sidebar' — Its spoken name while the sidebar is the rail.
- children?: ReactElement — With
asChild, that one control. - Also takes: asChild?: boolean; type?: 'button' | 'submit' | 'reset'; onClick?: (event: MouseEvent) => void; disabled?: boolean; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'
Keyboard
| Key | What it does |
|---|---|
| Enter | Activate |
Accessibility
- The part itself answers the keys above.
- hover, active: the browser's own (:hover, :active): 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.
Follows shadcn/ui's file names and conventions.