Skip to the page
Supply UI

Site menu

In code: SiteMenu

A site's menu on a small screen: a two-line button that opens a floating panel from the end of the screen, with the links set large and numbered, rising in one after another, and a painted picture with the actions at its foot. A link to a place on the page closes the menu first, then scrolls there. <SiteHeader> uses it; use it alone in a bar of your own, at the bar's end, shown where the links do not fit

Preview

Harbour Studio

Use

The code of the preview above
import { Button, Row, SiteMenu } from '@/components/ui';

<Row gap={3} center>
  <span className="ui-strong">Harbour Studio</span>
  <SiteMenu title="Harbour Studio" items={LINKS} actions={<Button variant="primary">Book</Button>} />
</Row>

This page as text, for an AI

Options

OptionTypeWhat it does
items NeededNavigationEntry[]The links, as for <SiteHeader>: plain links are set large and numbered, groups of links are listed under their name.
title NeededstringThe menu's title: the site's name. It also paints the picture at the foot of the menu.
actions ReactNodeAt the foot, under the picture: a button or two ("Sign in", "Book a stay").
aria-label stringWhat the navigation is: "Main".
className stringClasses of the two-line button that opens it.
current null | string · default nullThe link of the place the reader is in (#rooms): it is marked with a dot. A link with current is marked too.
link ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>>The app's own link component, as for <NavigationMenu>.

Without React

The same look on any HTML, with the classes header.ui-site-header > .ui-site-header-bar.

With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:

components/site-header.css

Showing things: states, do and don’t

The header of a public page or site, inside the page's Container (see The page): the brand (a plain name is drawn as a Logo), the main links (the same items as NavigationMenu) and one or two actions in one line. It floats: at the top of the page it sits on the page, and once the page scrolls it stays as a solid bar (sticky={false} leaves it in place). Links to places on the page (#rooms) follow the reader: the section in view is marked and the mark slides between links. When its box is narrower than 48rem it folds into a Burger that opens a floating menu: the links set large and numbered, rising in one after another, and a picture painted from menuTitle (the site's name) with the actions under it. A link to a place on the page closes the menu, then scrolls there. Use it rather than putting NavigationMenu in a Row yourself. SiteMenu is its phone menu alone (the two-line button and the panel it opens): for a bar of your own, put it at the bar's end and show it where the links do not fit. Never build another menu for a phone.

States. Lists, tables and boards have three more states besides their content: empty (Empty, with the first action inside), loading (Skeleton) and failed (Alert tone="danger"). A chosen row shows in ink, never in the brand colour.

Do

  • Put numbers, dates and codes in ui-mono (in a table cell, ui-num, which also aligns them).
  • Let a Table turn into blocks on a phone; give it scroll only when it is read down its columns.
  • Show a status in words and colour together (Badge tone="success" with "Paid"), never colour alone.

Don't

  • Don't put a card round a Table, List, Cells, Calendar or Empty: they draw their own box.
  • Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
  • Don't use the status colours (success, warning, danger, info) for anything but those meanings.