# Side menus and drawers · Divan

> The side menu tells people where they are and where they can go. Every app (the studio, the backoffice, the account, the brand book, the site’s drawer) draws it with SideMenu, in the desktop panel and in the phone’s drawer alike: one level at a time, each level below the top named under a step back, every section after the first labelled, the page you are on the one copper row, every name on one line.

Part of Divan, the DivanWorks design system. Web page: https://brand.divanworks.com/side-menus · All topics: https://brand.divanworks.com/llms.txt

## Rules

- SideMenu.Root (the nav, one per level) holds SideMenu.Title, SideMenu.Section and SideMenu.Item from #lib/components/ui/side-menu. Never hand-make a menu row: a row with parts of its own (a folder tree with a toggle) takes its class from sideMenuRow().
- Levels: the app’s own menu, then a collection (Projects, Settings), then one thing in it (a project: its overview, canon and releases, its story and lines), then one part of that thing (one line of a project, or its story). Never more than four. The app’s own menu starts with its home (the studio’s Getting started, where its own address and its name in the panel lead), the first row of its first section. A part is a level of its own with only what is that part’s (a line: its work, its pipeline, its releases, its folders, its own Trash), never its contents opened under its row among its siblings. A row that opens a deeper level has opens (a chevron at its end).
- A level below the top starts with SideMenu.Title: back={{ label, href or onclick }} names the level it returns to (the workspace’s name, ‹ Projects, the project’s name), never the app’s name the panel’s header already says. It is a gray capsule (Button variant="secondary"), so it is never read as a section’s label; the level’s own name below it is font-display text-title-3, up to two lines. Going back from a collection shows the level above without leaving the page; going anywhere shows the menu of where it leads. An action taken in a level (the workspace switcher) lands on a page whose menu is that level, so the menu never steps into a level the person did not open.
- Sections: rows that belong together. Every section after a level’s first has a label that says what it holds (Lines, Folders, Shared with you, Reply); a label never repeats the level’s name (under Projects, New Project and the projects are one section with no label). A label is a heading, not a row: text-caption font-semibold text-faint, no icon, so it never looks like something to press; one icon button may sit at its end (action snippet: New Folder). Never hand-make a label: SideMenu.Section draws it. Sections stand apart by space alone, never a line.
- The foot section (SideMenu.Section foot) is pinned to the bottom of the panel: Trash and Settings, under everything the work is done in. The scroll area around the menu is a flex column (relative flex min-h-0 flex-1 flex-col overflow-y-auto) and the menu fills the rest of it (flex-1), so the foot reaches the bottom; never min-h-full, which adds the header’s height and pushes the foot out of the panel.
- Rows: labels in text-foreground, icons in text-muted-foreground, so each row reads at a glance. current marks the page you are on (copper tint and copper text, one row per menu); action marks a row that makes something (New Project: copper, no fill, first in its section). 32px tall, 40px on a touch screen, one line: a long name (a project, a folder, a file) is cut short with an ellipsis and shows whole on hover, only while it is cut (sideMenuLabel and wholeWhenCut for a row with parts of its own). Our own words are written to fit the 224px panel in both languages, so they are never cut.
- In one menu every row has an icon, or none does. A count or a status goes at the end (trailing): faint numbers, or a Status dot. A tree in the menu (the studio’s folders, the Canon) is SideMenu.TreeItem: its rows start where the other rows start, with the same icon size, and only nesting steps in. Its controls stay inside the row, never beside it: the open-and-close arrow (pointing down) takes the icon’s place, the row’s + or … takes the count’s place, on hover, keyboard focus, an open menu, and always on a touch screen. Every count, arrow and + of a menu ends in one line, at the rows’ end; a section label’s button (New Folder) stands in the same line.
- A row to another page of the section you are in keeps what the section’s pages share in the address (the backoffice’s chosen round, ?id=, through navQuery and NAV_KEEPS in src/lib/backoffice-nav.ts), so the choice stays and only the new page loads; a page’s own filter or sort stays behind. current still comes from the path alone.
- One menu snippet, drawn twice: SideMenu.Panel, the card-tone panel beside the page from 768px (224px wide in every app; the page starts at md:ms-63), and a Sheet from the start side on phones. The panel’s header holds the app’s name (its link home) and, when there is one, the workspace switcher; the page’s header holds at its end what is used from every page (the studio’s Quick generations: a ghost link-button with its icon, lifted on its own page; an icon button in the phone’s bar), then the language and the account. Never hand-make the panel (an <aside class="md:fixed …">).
- The panel folds away (the button at the end of its header, or ⌘\ / Ctrl+\ from 768px): it slides out to the start side while the page widens (md:ms-63 panel-closed:md:ms-0 md:transition-[margin-inline-start] md:duration-300 md:ease-out motion-reduce:transition-none), and SideMenu.PanelShow label="Menu" at the start of the page’s header brings it back. The choice is kept in the browser (src/lib/state/side-panel.svelte.ts) and set on <html data-side-panel="closed"> by src/app.html before the first paint, so a folded panel never shows for a moment. The keyboard moves to the button that undoes it, never stays on something hidden.
- The menu shows one level; Breadcrumbs (#lib/components/ui/breadcrumbs) at the top of every page show the whole way down: the company, the workspace, then the project, its line and each folder to the open one. Each step but the last is a link, the last is the page itself in the foreground; a long name is cut short (each step at most 15rem) and shows whole on hover; they are a row of their own under the page’s header (on a phone, under its bar), shown when there is more than one step, never squeezed beside the header’s buttons (pnpm divan:lint: breadcrumbs-share-row). A company and its workspace of the same name are one step; a place the person cannot open (another company’s, for a project shared from there) is named without a link.
