Seven sidebar shapes
Team, one person, admin, rail, two levels, saved views, recent items
Seven sidebars the parts make, each a Sidebar with a SidebarHeaderRow in its SidebarHeader, then SidebarContent and often a SidebarFooter. They differ in what they are built from, not only in their words: pick by who uses the app and what a person comes back to (in an app built on the screen recipes, the frame draws the plainer shapes from its props: docs/screen-frame.md, "Which sidebar"; draw the others in its place from the parts below).
Which one
| Shape | Its structure | Pick it when | | --- | --- | --- | | A team's workspace | switcher at the top, search bar with a create button, your pages with counts, each team a folding section with its mark and nested rows, an invite row over the account | several people share the app in teams or projects, each with the same few pages of its own | | A tool for one person | the app's name with a new-item button, a search field that narrows the sidebar in place, pinned items folding over the main lists, Settings and Help at the foot | one person, one place: no workspaces to switch, nobody to invite, a handful of lists and the items they keep close | | An admin console | the way back to the app, a search field that finds a setting, areas that fold from their labels with counts and an add button on one label | many settings or places grouped in a few areas, where a person looks one up by name | | A compact rail | the sidebar opened as its 44 px rail: the workspace tile, the toggle, icon rows with tooltips, a folded section as one button with a menu of its rows, the account avatar | the page needs the width (a dashboard, a board, an editor) and the places are few enough to know by their icons | | Two levels | an icon rail of the product's areas beside a column of the current area's views and a folding section, the account at the column's foot | the product has several large areas (studies, inbox, calendar, reports), each with its own views and folders | | Saved views | the app's name with search and create buttons, the record pages with counts, the person's saved filters folding with counts and a plus that saves one, the team's views folded, a plan card with a usage meter over the account | a records app (clients, contacts, deals) where each person keeps their own filtered lists and the plan has a limit worth showing | | Recent items | the app's name with a search button, one wide new-item button, two fixed pages, then the recent items under the day they were last used, each removed by its cross | what a person comes back to is a long, growing list of their own items (chats, documents, drafts) rather than a few fixed pages |
The parts of each
- A team's workspace:
WorkspaceSwitcheralone in the header row; under it a searchButtonthat opens theCommandPalette(CommandPaletteTrigger asChild, Cmd/Ctrl K) with an outlineIconButtonasCreateDialog'striggerat its end; your pages in aSidebarGroupwith no label (SidebarMenu,SidebarMenuItem,SidebarMenuButton, a count inSidebarMenuBadge); then oneSidebarGroup collapsible variant="item"per team, itsSidebarGroupLabelwith the team'smark(a solid 14 pxAvatar size="3xs"with the team's initial) and aCollapsibleActionplus that makes a task in that team, its rows nested under the name (defaultOpen={false}on all but the first); inSidebarFooteran "Invite people"SidebarMenuButtonthat opens theInviteDialog, then the person'sAccountMenu. - A tool for one person: the app's name in
SidebarTitlewith a ghostIconButtonafter it asCreateDialog'strigger; aSearchInput size="sm"under the row that narrows the sidebar's rows and the page as a person types ("/" focuses it, Escape clears it); aSidebarGroup collapsiblelabelled Pinned whose rows each carry aSidebarMenuAction icon="x"that unpins it, over one unlabelledSidebarGroupof the lists; Settings and Help asSidebarMenuButtonrows in aSidebarMenuinSidebarFooter. - An admin console: a
Linkback to the app in the header row and aSearchInput size="sm"under it; oneSidebarGroup collapsibleper area (defaultOpen={false}on one seldom used; heldopenwhile the search narrows, so every area with a match shows it), aSidebarMenuBadgecount on a row that waits on someone, and an add button on a label (SidebarGroupLabel action={<SidebarGroupAction icon="plus" aria-label="…" />}). - A compact rail:
Sidebar defaultOpen={false}, theWorkspaceSwitcherthenSidebarRailTogglein the header row, everySidebarMenuButtonwith itsicon(the rail shows the icon alone and its words in a tooltip), a section that starts folded (SidebarGroup collapsible defaultOpen={false}) standing as one button whose menu lists its rows (give its label amark, a star for starred items, so the button never wears the folder a destination row does), theAccountMenuinSidebarFooter; the toggle or Cmd/Ctrl B widens it. - Two levels: two
Sidebars side by side in the frame's rail. The first is held as its rail (open={false},shortcut={false}, no toggle): theWorkspaceSwitcherin its header row, the areas asSidebarMenuButtonrows with their icons, Settings in itsSidebarFooter. The second is the area's column: its name inSidebarTitlewith a ghostIconButtonasCreateDialog'strigger, its views withSidebarMenuBadgecounts, oneSidebarGroup collapsible(folders, calendars), theAccountMenuin itsSidebarFooter. Give each its ownaria-label, and the first the frame's hairline down its end (after:border-e-half after:border-accent-strong, drawn over it) where the two share one fill; picking an area swaps the second. Below the frame's wide window both stand in its navigation sheet, one over the other. - Saved views: the app's name in
SidebarTitle, then two ghostIconButtons, one theCommandPalette's trigger (tooltipKeys={['⌘', 'K']}), oneCreateDialog's; the record pages with counts; aSidebarGroup collapsibleof the person's views with aSidebarGroupActionplus that saves the current filter under a name (aCreateDialog), and one more, folded, of the team's; inSidebarFooteraCard variant="outline"holding aMeter(withMeterLabel,MeterValueand athreshold) and a small outlineButton, over theAccountMenu. - Recent items: the app's name in
SidebarTitlewith a ghostIconButtonthat opens theCommandPalette; one wide outlineButtonfor a new item under the row; aSidebarGroupof two fixed pages; then one staticSidebarGroupper day (SidebarGroupLabel"Today", "Previous 7 days", "Older"), each row aSidebarMenuButtonwith the item'sicon(so the day's label stands on the glyphs' edge) and aSidebarMenuAction icon="x"that removes it (a day with none left is not drawn); theAccountMenuinSidebarFooter.
The slots a start turns on
node goop/agent/start.mjs --app <type> writes the file below with the slots its type's row names (the head's workspace switcher, the search, the rail, the account at the foot, the recent items under their day, each a link to its own route) and puts <SidebarShape> round every screen in App.tsx, so each screen's frame draws them (FrameShape, docs/screen-frame.md). Turn a slot on or off in SLOTS; swap the sample workspaces, person and recent items for your store's. A sign-in's own menu (docs/screen-account.md) wins over the sample person.
`tsx shape // src/screens/sidebar.tsx: the sidebar's slots on every screen, those your app type's row names import { type ReactNode, useState } from 'react'; import { AccountMenu, AccountMenuColorMode, AccountMenuContent, AccountMenuHeader, AccountMenuTrigger, } from '@/components/ui/goop/account-menu'; import { DropdownMenuItem } from '@/components/ui/goop/dropdown-menu'; import { SAMPLE_BRAND } from '@/lib/goop/trail/sample-brand'; import { FrameAccount, type FrameSection, FrameShape, hasPage } from './frame'; import { hrefOf } from './router';
// ---- the slots your app's sidebar draws: the head's workspace switcher, the search, the rail, the account, the recent const SLOTS = { switcher: false, search: false, rail: false, account: false, recent: false };
// ---- sample workspaces and person: swap them for your store's const WORKSPACES = [{ id: SAMPLE_BRAND.address, name: SAMPLE_BRAND.name }]; const PERSON = { name: 'Teodora Valk', email: 'teodora.valk@fieldwork.test' };
// ---- sample recent items under the day they were last used: swap them for your store's, newest first const RECENT: readonly FrameSection[] = [ { label: 'Today', rows: [{ words: 'Consent step in the interviews', path: '/chat/consent', icon: 'message' }] }, { label: 'Previous 7 days', rows: [{ words: 'Reminders for Thursday’s visits', path: '/chat/reminders', icon: 'message' }], }, { label: 'Older', rows: [{ words: 'Eastgate Library visitor survey', path: '/chat/library', icon: 'message' }] }, ];
/** The person's menu at the sidebar's foot, until a sign-in gives its own (FrameAccount). */ function SampleAccount() { return ( <AccountMenu> <AccountMenuTrigger name={PERSON.name} email={PERSON.email} /> <AccountMenuContent> <AccountMenuHeader /> {hasPage('/settings') ? ( <DropdownMenuItem icon="settings" asChild> <a href={hrefOf('/settings')}>Settings</a> </DropdownMenuItem> ) : null} <AccountMenuColorMode /> </AccountMenuContent> </AccountMenu> ); }
/** Round every screen in App.tsx: each screen's frame draws the slots on; a screen's own props win. */ export function SidebarShape({ children }: { children: ReactNode }) { const [workspace, setWorkspace] = useState<string>(SAMPLE_BRAND.address); const switcher = { workspaces: WORKSPACES, value: workspace, onValueChange: setWorkspace }; const shape = { search: SLOTS.search, collapsible: SLOTS.rail ? ('rail' as const) : false, ...(SLOTS.switcher ? { switcher } : {}), ...(SLOTS.recent ? { sections: RECENT } : {}), }; const shaped = <FrameShape value={shape}>{children}</FrameShape>; return SLOTS.account ? <FrameAccount account={<SampleAccount />}>{shaped}</FrameAccount> : shaped; }
```tsx app
// src/App.tsx: the shape's two lines in the app recipe's App.tsx (start.mjs adds them with --app)
import { SidebarShape } from './screens/sidebar';
<SidebarShape>{screenFor(route)}</SidebarShape>