Divan

Components

Side menus and drawers

The side menu is how people know where they are and where they can go. Every app draws it the same way, in the desktop panel and in the phone’s drawer: one level at a time, each level named under a step back, each section labelled, the page you are on in copper, every name on one line.

Four levels

  • One level at a time: the app’s own menu, then a collection (Projects, Settings), then one thing in it (a project), then one part of that thing (one of its lines, or its story). Never more than four.
  • A part is a level of its own, with only what is that part’s: a line’s work, its pipeline, its releases, its folders and its own Trash. Its contents never open under its row among its siblings.
  • A level below the top starts with SideMenu.Title: the step back, a gray capsule named after the level it returns to (the workspace’s name, ‹ Projects, the project’s name), above the level’s own name. Never the app’s name the panel’s header already says.
  • A row that opens a deeper level ends with a chevron (opens). Going back from a collection shows the level above without leaving the page.
  • 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 none.
  • A label is a heading, not a row: caption size, semibold, faint, no icon, so it is never taken for something to press. One icon button may sit at its end (action: New Folder).
  • The app’s home is the first row of its own menu (the studio’s Getting started, where its address and its name lead); Trash and Settings sit in the foot section, pinned to the bottom of the panel, under everything the work is done in.
  • Each project shows what it makes: the icon of its first line until it has a cover. 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 nobody opened.

The studio, from its menu into Projects, then into one project, then into one of its lines. A row that opens a deeper level ends with a chevron; the level below names itself under a step back to the one above. Three kinds of words, never alike: the step back is a capsule, a section’s label is small and quiet, a row reads in the foreground.

Where you are

  • Every page of an app with workspaces starts with Breadcrumbs: the company, the workspace, then the project, its line and each folder down to the open one (or the app’s page: Quick generations, Trash, Settings › Company).
  • Each step but the last is a link; the last is the page itself, in the foreground. A long name is cut short with an ellipsis (each step at most 15rem) and shows whole on hover; the chevrons turn in Persian.
  • A company and its workspace of the same name are one step, so no name is said twice. A place the person cannot open (another company’s, for a project shared from there) is named without a link.
  • They are a row of their own under the page’s header, shown when there is more than one step: on a desktop under the row with Quick generations, the language and the account; on a phone under its bar. Never squeezed beside the header’s buttons.

The menu shows one level; the top of the page shows the whole way down, from the company to the open folder.

Rows

  • Rows are SideMenu.Item: 32px tall, 40px on a touch screen, one line each. 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; the level’s title keeps two lines. Our own words are written to fit the 224px panel in both languages, so they are never cut.
  • current marks the page you are on: the copper tint and copper text, one row per menu.
  • action marks a row that makes something (New Project): copper with no fill, first in its section.
  • In one menu every row has an icon, or none does, so the labels start in one line.
  • A tree in the menu (a line’s folders, the Canon) is SideMenu.TreeItem: its rows start where the other rows start; only a folder inside another steps in. Its two controls stay inside the row: the open-and-close arrow takes the icon’s place and points down, the row’s + or … takes the count’s place, on hover, on keyboard focus and always on a touch screen. So every count, arrow and + of the menu stands in one line at the rows’ end.
  • A count or a status goes at the end (trailing), in faint text or a Status dot; never a coloured box.
  • A row to another page of the section you are in keeps what the section’s pages share in the address (the chosen round, ?id=), so the choice stays and only the new page loads; a page’s own filter stays behind. current still comes from the path alone.

Labels read in the foreground and icons in muted, so a row is read at a glance. The page you are on is the one row in copper.

Desktop panel and phone drawer

  • One menu snippet, drawn twice: in SideMenu.Panel, the card-tone panel beside the page from 768px (224px wide in every app, the page starting at md:ms-63), and in a Sheet from the start side on phones (left in English, right in Persian).
  • The panel folds away to give the page the whole width: the button at the end of its header, or ⌘\ (Ctrl+\). It slides out to the start side while the page widens into its room, in one movement of 300ms (none when the system asks for less motion). While it is folded, SideMenu.PanelShow at the start of the page’s header, an icon and the word Menu, brings it back.
  • The browser keeps the choice for every page of the app and its other tabs. A panel kept folded is folded before the first paint (src/app.html sets data-side-panel on <html>), so it never shows for a moment; the page’s CSS follows it with panel-closed: (md:ms-63 panel-closed:md:ms-0).
  • The keyboard is never left on something hidden: folding from the panel moves it to Menu, bringing it back moves it to the panel’s button, and the shortcut pressed while typing leaves it in the field.
  • The panel’s header holds the app’s name (the link to its start) and, when there is one, the switcher for the workspace; the menu scrolls under it inside a flex column, so the foot section reaches the bottom.
  • The account and the language live in the page’s header, never at the foot of the menu.

Code

SideMenu · The side menu of every app, in the desktop panel and the phone drawer: a level’s title under a step back (a gray capsule), labelled sections (a quiet heading, with one icon button at its end), rows of one line (current, action, opens, trailing), tree rows that keep their arrow and their + inside (TreeItem), a foot section pinned to the bottom; Panel, the desktop panel that folds away, and PanelShow, the Menu button that brings it back.

import * as SideMenu from '#lib/components/ui/side-menu/index.js';

<SideMenu.Root label="Projects">
	<SideMenu.Title back={{ label: workspace.name, onclick: toMainMenu }}>Projects</SideMenu.Title>
	<SideMenu.Section>
		<SideMenu.Item action icon={PlusIcon} onclick={() => (newProject.open = true)}>New Project</SideMenu.Item>
		{#each projects as p (p.id)}
			<SideMenu.Item href="/projects/{p.id}" icon={FolderIcon} opens current={p.id === open}>{p.name}</SideMenu.Item>
		{/each}
	</SideMenu.Section>
	<SideMenu.Section label="Folders">
		{#snippet action()}<Button variant="ghost" size="icon-sm" aria-label="New Folder" onclick={newFolder}><PlusIcon /></Button>{/snippet}
		…
	</SideMenu.Section>
	<SideMenu.Section foot>
		<SideMenu.Item href="/settings" icon={SettingsIcon} opens>Settings</SideMenu.Item>
	</SideMenu.Section>
</SideMenu.Root>

Breadcrumbs · Where the page is, at its top, from the company down: the workspace, the project, its line, each folder to the open one. Every step but the last is a link; the last is the page itself. A long name is cut short (each step at most 15rem) and shows whole on hover; each reads in its own direction; the chevrons turn in Persian.

import { Breadcrumbs, type Crumb } from '#lib/components/ui/breadcrumbs/index.js';

<Breadcrumbs
	label="Where you are"
	items={[
		{ label: 'Shahnameh Studios', href: '/settings/company' },
		{ label: 'Kids', href: '/projects' },
		{ label: 'Zal and the Simorgh', href: '/projects/1' },
		{ label: 'Films', href: '/projects/1/films' },
		{ label: 'Scene 1' }
	]}
/>

Sheet · A task of its own, or the drawer menu.

import * as Sheet from '#lib/components/ui/sheet/index.js';

<Sheet.Root bind:open>
	<Sheet.Trigger>{#snippet child({ props })}<Button variant="ghost" size="icon" aria-label="Menu" {...props}><MenuIcon /></Button>{/snippet}</Sheet.Trigger>
	<!-- start for a menu, end for a task: the left or the right by the page’s language -->
	<Sheet.Content side="start" dir={isFa ? "rtl" : "ltr"}>…</Sheet.Content>
</Sheet.Root>