Skip to content

Header ​

The bar across the top of every Keston app: menu button, app name, an optional middle area, actions and the account menu. The same in every app; each part can be overridden.

Open in Storybook to try every prop.

When to use ​

  • Once per app, at the top of every page, above the Sidebar and content.

When not to use ​

  • Headings inside a page or panel (use a heading, or the Slideover's header).

Anatomy ​

PartRequiredNotes
menuNoGhost square Button with a menu icon. Opens the Sidebar on small screens.
leadingNoBefore the title, e.g. a logo.
titleNoApp or area name. Bold, truncates.
middleNoFills the space between title and trailing, e.g. breadcrumbs.
trailingNoActions before the account menu, e.g. notifications.
accountNoRound avatar (picture or initials) opening the account menu; Sign in button when signed out. Slot account replaces it.
account menuNoPanel under the avatar: organisation, large avatar, name, email, with a small basic Account settings button under them; then a row of basic buttons, Switch account (left) and Log out (right). Slot account-menu adds content above that row.

Properties ​

PropertyTypeDefaultDescription
titlestring—App or area name.
menubooleanfalseShow the menu button (emits menu).
menuOpenboolean—Whether what it opens is open (aria-expanded).
menuControlsstring—Id of what it opens (aria-controls).
menuLabelstring"Menu"Accessible name of the menu button.
user—Signed-in user. Shows the account menu.
userActions('account-settings' | 'switch-account' | 'log-out')[]all threeActions in the account menu (positions are fixed). Each emits an event of the same name.
signInbooleantrueShow Sign in (emits sign-in) when there is no user.
stickybooleantrueStay at the top while the page scrolls.
ui—Extra classes per part, e.g. menu: 'lg:hidden'.

Sizes ​

SizeHeightPadding (x / y)GapIcon sizeText style
—spacing 12 (48px)spacing 4 / —spacing 216pxtitle: base, bold

States ​

StateAppearanceNotes
Enabledwhite, bottom border black 15%
Stickyas enabled, pinned to the topz-index above content, below dialogs

Behaviour ​

  • Menu button: press emits menu; the app opens the Sidebar (in a Slideover) itself.
  • Account menu: opens on click / tap / Enter below the avatar, aligned to its right edge (w-72). Focus moves into it; Escape or clicking outside closes it. Choosing an action closes it, then emits the event; the app does the navigation or sign-out.
  • The menu button's icon lines up with the header's padding (negative margin), like the × in Slideover.

Accessibility ​

  • Rendered as <header> (banner landmark when at the top level of the page).
  • The title is not a heading; each page keeps its own h1.
  • Icon-only buttons in trailing need an aria-label.
  • The avatar button is named "Account: {name}", or "{initials}, account: {name}" when it shows initials, so its visible text is part of its name (voice control). Pictures and initials are hidden from assistive tech, as the name is in the label.

Platform adaptation ​

PlatformImplementationDifferences
Web / desktop (Vue)Header.vue—
iOS (SwiftUI)—Navigation bar / toolbar.
Android (Compose)—TopAppBar.

Tokens used ​

TokenUsed for
color whitebackground
color black (15%)bottom border, account menu divider
color primaryavatar initials background

Do / Don't ​

DoDon't
Keep trailing to a few icon buttons and one primary action.Put full forms or labelled fields in the header.

Released under the PolyForm Noncommercial License 1.0.0.