Skip to the page
Supply UI

Menubar

The menus of an application in one row: File, Edit, View. Put <Menu>s inside, each with a <MenubarTrigger> and a <MenuContent>. Tab enters the bar once, the arrow keys move between the menus, and pointing at another one while a menu is open switches to it.

Preview

Use

The code of the preview above
import { useState } from 'react';
import {
  Menu,
  MenuCheckboxItem,
  MenuContent,
  MenuItem,
  MenuSeparator,
  Menubar,
  MenubarTrigger,
} from '@/components/ui';

function MenubarDemo() {
  const [grid, setGrid] = useState(true);
  return (
    <Menubar aria-label="Menu editor">
      <Menu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenuContent>
          <MenuItem shortcut="mod+n">New menu</MenuItem>
          <MenuItem>Save a copy</MenuItem>
          <MenuSeparator />
          <MenuItem shortcut="mod+p">Print</MenuItem>
        </MenuContent>
      </Menu>
      <Menu>
        <MenubarTrigger>Edit</MenubarTrigger>
        <MenuContent>
          <MenuItem shortcut="mod+z">Undo</MenuItem>
          <MenuItem shortcut="mod+shift+z">Redo</MenuItem>
        </MenuContent>
      </Menu>
      <Menu>
        <MenubarTrigger>View</MenubarTrigger>
        <MenuContent>
          <MenuCheckboxItem checked={grid} onCheckedChange={(on: boolean) => setGrid(on)}>Show grid</MenuCheckboxItem>
        </MenuContent>
      </Menu>
    </Menubar>
  );
}

This page as text, for an AI

Options

OptionTypeWhat it does
className stringMore classes on the outer element, for layout around it (margins, grid placement), not to restyle it.

It also takes the 286 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.

Parts

What goes inside one.

Without React

The same look on any HTML, with the classes (React only).

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

components/button.csscomponents/popups.csscomponents/icons.csscomponents/menu-items-tick.csscomponents/prose.cssparts/listbox.cssparts/menubar.css

In the examples

Small screens made with it and the rest of the kit. They work: click, type and choose in them.

Grid on100%
File, View, the old way Menus of an application, ticks and choices included

Showing things: states, do and don’t

The menus of an application in one row: File, Edit, View. It draws its own bar (a quiet fill under the menus).

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.