Density

Compact by default for a mouse, larger by itself on touch. Step down a size only where many controls share a row.

Use the default size, step down only inside a dense row or toolbar, and leave touch to the components. The default is drawn for a mouse, so a screen shows as much of the work as it can; on a coarse pointer the same controls, drawn the same, take hit areas and room between them without the app asking.

CI #1284
  • Lint5s
  • Build11s
  • Test7s

The run's toolbar and each job's Log are a size down, because they repeat and sit next to content; the two actions that close out the panel are the default size. Press Touch above the example to see the same tree make room for a thumb.

Sizes#

Every number on this page is the default style's. Another style draws the same sizes at its own heights, and a coarse pointer adds the same room around them all the same. Every size of Button, as the default style draws it:

SizeHeightUse
lg32pxThe one action a page or empty state is for; a call to action on a landing page
default28pxForms, dialogs, a panel's own actions: anything a person reads before pressing
sm24pxA toolbar of text buttons, a filter row, actions inside a card
xs22pxAn action repeated on every row of a list or table, inline with text
icon, icon-sm, icon-xs, icon-lg28, 24, 22, 32px squareThe icon-only counterparts of the four
lg
default
sm
xs
Lint
icon-*

Each size where a demo uses it: Compose on Mail's phone layout, the profile form's buttons in Settings, Recording above a pull request's test log and Revoke… on each access token, each job's Log in the panel above, and Archive at every icon size.

Input and Select's trigger are 28px, the default, so a field and its button line up on one row. Select's trigger also comes in sm for a toolbar.

Controls side by side in one row take one size, so their tops and bottoms line up in every style: a SegmentedControl takes size as a Button does, and beside sm buttons is sm too; next to a field, which has only the default size, a button keeps the default. A Toolbar gives every part in it the bar's size, so a row of commands, with a segmented control among them, is one Toolbar rather than parts sized one by one, as the bar over each demo is.

Do

Keep the default size and let a coarse pointer add the room around it. One layout serves the mouse and the thumb.

Don't

Pass size="lg" when the screen is narrow, or branch on width to make touch targets. A narrow window on a desktop is still clicked, and a tablet is wide and still touched.

Information density#

  • A row holds one primary line in text-ui and at most one secondary line in text-ui-sm. More than that belongs in the detail view.
  • Repeated per-row actions are small and quiet (ghost, xs). One that destroys and asks first is destructive at sm, whose tint stays quiet until it is needed: the Settings demo's Revoke… on each token. A single action for the whole view is default size and stands apart.
  • On a pointer, a row's secondary actions can wait in a DropdownMenu behind a ⋯ button; they are not hidden until hover, which leaves keyboard and touch users nothing to press.
  • Dense is not cramped: rows keep gap-2 between their parts and a 28px row height with a mouse, so a misclick lands on the right row.

Inbox

  • Unread: Touch sizes for the toolbar iconsAlice, claude-agent
  • Unread: Release 0.9.0: changelog draftbot-one
  • Flaky test: retry-once times out on the slow runnerCI, Newcomer, Alice
  • Unread: Search on the docs site ranks the Storybook pages too highNewcomer

Each conversation is a subject over its senders. Its actions wait behind a quiet ⋯ that is always there, and Compose, the one action for the whole list, is the default size above it. Archive a conversation, then press Undo in the toast.

On each platform#

  • Pointer. The sizes above. Neighbouring controls can sit 4px apart; a mouse lands reliably on a target of WCAG's 24px minimum (2.5.8).
  • Touch. On a coarse pointer @orz/ui's touch: variant keeps each control as it is drawn, gives it an invisible 36px hit area, and keeps neighbouring targets that far apart: between the 28pt Apple allows and the 44pt it gives a control by default (Apple HIG: Accessibility), and never below that 24px minimum. Touch & mobile has the size of each part. A row you build yourself makes the room the same way: touch:min-h-touch.

In the demos