Skip to main content

TopBar

The top bar is a persistent interface that spans the full width of the viewport and is always the topmost component on the page. It offers a consistent location for page navigation while also giving users quick access to cross-application features such as system settings, search and notifications.

Base
Custom component
Mantine
None — built here
Import
{ TopBar } from '@multiconsult-group-products/design-system'
Source
src/components/TopBar/
TopBar.tsx
TopBar.module.css
TopBar.context.ts
TopBarNavigation.tsx
TopBarNavItem.tsx
TopBarNavMenu.tsx
TopBarSearch.tsx
TopBarSelector.tsx
TopBarLanguage.tsx
TopBarMessages.tsx
TopBarHamburgerMenu.tsx
TopBarSecondary.tsx

Usage​

React
<TopBar
logo={<AppLogo />}
navigationItems={[
{ key: 'oversikt', label: 'Oversikt', active: true, linkProps: { to: '/oversikt' } },
{ key: 'prosjekter', label: 'Prosjekter', linkProps: { to: '/prosjekter' } },
{ key: 'rapporter', label: 'Rapporter', linkProps: { to: '/rapporter' } },
]}
messages
messageItems={meldinger}
onMarkAllRead={markAllRead}
onViewAllMessages={openInbox}
hamburgerMenuItems={hovedmeny}
onSignOut={loggUt}
>
</TopBar>

Properties​

Overview​

Every property TopBar takes, grouped by the slot it belongs to and in the order the bar renders them. Each slot has a section of its own further down with its entry types and the reasoning behind the shape; this table is the index.

These are our properties, and the defaults are ours — not Mantine's. On top of them the bar accepts the style props and HTML attributes listed under Inherited props.

PropertyTypeAllowed valuesDefaultDescription
The bar
sizeTopBarSizesm · mdmdSets the bar's height — 56px or 64px.
environmentTopBarEnvironmentPROD · DEV · TESTPRODDEV and TEST paint the bar teal, so it is not mistaken for production.
Logo — slot 1
logo*ReactNode——The application's own mark, as a rendered element — see Logo and title.
betaboolean—falseShows the BETA brand under the logo, marking a pre-release application.
Title — slot 11
titleTextstring——The title shown beside the logo. Passing it is what renders the slot.
Navigation menu — slot 2
navigationItemsTopBarNavigationItem[]—[]The main navigation, as data. Passing entries renders it.
navigationLabelstring—'Hovednavigasjon'Accessible name of the navigation landmark.
Application content — slot 3
childrenReactNode——What the application renders in the open area between the navigation and the platform controls.
Search — slot 4
searchTopBarSearchConfig——The search button and its Spotlight panel. Passing the config is what renders them.
Selector — slot 5
selectorsTopBarSelectorConfig | TopBarSelectorConfig[]—[]One context selector or several. Passing them is what renders them.
Language selector — slot 6
languagesTopBarLanguageItem[]—[]The languages the application offers. Passing two or more is what renders the control.
languagePlacementTopBarLanguagePlacementtopbar · hamburgerMenutopbarWhether the control is its own in the bar or a drill-in row in the hamburger menu.
languagestring——Code of the current language. Omit to let the control keep its own state.
defaultLanguagestring—languages[0].keyCode selected at mount when language is not given.
onLanguageChange(key: string) => void——Called with the code of the chosen language.
languageLabelstring—'Velg språk'Accessible name. Names the choice; the current language is appended to it.
Utility items — slot 7
utilityItemsTopBarUtilityItem[]—[]One icon button per entry, for modules and functions inside the application.
Profile — slot 12
onProfileClick() => void——What the button does. Passing it is what renders it.
profileLabelstring—'Profil'Accessible name of the profile button.
In-app messages — slot 8
messagesboolean—falseRenders the messages bell and its panel.
messageItemsTopBarMessage[]—[]The newest messages. The panel shows the first six and scrolls.
messageCountnumber——Unread count on the badge. Derived from messageItems when omitted; zero shows no badge.
onMarkAllRead() => void——Marks every message read. Passing it renders the header button.
onViewAllMessages() => void——Opens the full inbox. Passing it renders the footer link.
messagesLabelstring—'Meldinger'Panel heading, and the bell's accessible name when nothing is unread.
messagesUnreadLabel(count: number) => string—'N uleste meldinger'Builds the bell's accessible name when something is unread.
markAllReadLabelstring—'Merk alle som lest'Visible text of the mark-all-read button.
viewAllMessagesLabelstring—'Se alle meldinger'Visible text of the footer link.
messagesEmptyLabelstring—'Ingen meldinger'Shown in place of the list when there are no messages.
Hamburger menu — slot 10
hamburgerMenuItemsTopBarHamburgerMenuGroup[]—[]The application's own menu entries, in groups. Passing entries renders the trigger.
hamburgerMenuLabelstring—'Meny'Accessible name of the menu trigger.
onSignOut() => void——What signing out does. Passing it renders the Logg ut row, always last in the menu.
signOutLabelstring—'Logg ut'Visible text of the sign-out row.
Secondary bar
breadcrumbItemsTopBarBreadcrumbItem[]—[]Breadcrumb levels after the ones derived from the navigation.
breadcrumbsLabelstring—'Brødsmulesti'Accessible name of the breadcrumb landmark.
secondaryContentReactNode——The application's own controls, between the breadcrumbs and the actions.
secondaryActionsTopBarSecondaryAction[]—[]Action buttons on the right. Below 900px they fold into one menu.
secondaryActionsMenuLabelstring—'Flere handlinger'Accessible name of the menu the actions fold into.

* Required

logo is the only required prop, and every control in the bar is off until a prop turns it on — so <TopBar logo={<AppLogo />} /> is a legitimate bar, and one that shows nothing but the mark. Nothing has to be switched off, because nothing arrives switched on.

messages is switched on by a boolean named after the slot, and only decides whether the bell is there — the panel behind it is the bar's own, so it works with no handler at all. The profile button has no such panel, so the handler is its switch: passing onProfileClick is what renders it, and there is no boolean beside it to leave a focusable control that does nothing when activated. Everywhere else the content is the switch: search and selectors render their control when you pass a config, navigationItems, utilityItems, languages and hamburgerMenuItems when they have entries, and nothing when they do not. What a control does when a user activates it is otherwise the application's, through the handler beside it. The bar never moves an action from a slot you left off into one you turned on: a handler passed to a control that is not rendered simply does nothing, and an application that wants the same action somewhere else passes it there itself.

Every icon-only control takes an overridable Norwegian label prop — languageLabel, profileLabel, hamburgerMenuLabel and the messages panel's five — rather than hardcoded copy, so an application built on this system can set its own language. It is not optional here: messages, the hamburger menu and the profile button carry no visible text at all. Utility items take their label per entry instead, since those buttons are the application's own.

Slots 4 and 5 are the exception, and in the other direction: their label is label on the config, and it is required rather than defaulted. A bar-level default could only ever be generic, and Søk or Velg is precisely what a search field and a context selector must not be called — see Search.

Setting the labels once​

The bar has a lot of label props, and passing all of them at every call site is not the intended way to use it. Set them once in the theme instead — TopBar reads its defaults through useProps, so anything you put here becomes the application's own default:

React
const theme = createTheme({
components: {
TopBar: TopBar.extend({
defaultProps: {
profileLabel: 'Profile',
hamburgerMenuLabel: 'Menu',
messagesLabel: 'Messages',
markAllReadLabel: 'Mark all as read',
},
}),
},
});

TopBarNavItem and TopBarNavMenu register under their own names, so their defaults go on those rather than on TopBar. Slots 4 and 5 take none of this: their strings live on the config — label required, emptyLabel and loadingLabel defaulted inside the control — so an application that wants them in another language sets them where it passes the config. An application on i18next resolves the rest where it builds the theme, or passes the handful that change per page at the call site.

Height​

size sets the bar's height: md (64px, the default) or sm (56px, Figma's own). The secondary bar adds 40px when it shows. The header's full height is published on the root as --topbar-height, so the page below can offset itself against the same value rather than restating the number:

CSS
.appContent {
height: calc(100vh - var(--topbar-height));
}

The navigation items fill the bar's full height at both sizes, so the hover and active fill runs from the top edge to the bottom edge.

Logo and title​

titleText is the switch. Passing it renders slot 11; leaving it out omits the slot entirely, and the navigation moves left to close the gap. There is no boolean beside it, because the one state such a boolean could have added — the slot on with nothing in it — is not a state worth having: an empty title element would still be a flex item, and a flex item with no content still takes the bar's own 16px gap, leaving a hole that nothing on screen explains.

logo takes a rendered mark, not a path to one. The bar is permanently dark, so a near-black export has to be recoloured, and CSS cannot reach inside an SVG loaded through <img src> — the logo element paints white and an inline currentColor mark inherits it. An application that only has a file passes <img src="/logo.svg" alt="" /> itself; it does not get a logoSrc prop, because that shape would work for exactly the case that needs the recolouring.

Which alt that <img> carries is a decision, not a formality. alt="" is right when the mark is decorative — titleText or the page title already says which application this is, and an alt text would only have a screen reader announce the name twice. When the mark is the only thing identifying the application, alt names it.

Linking the mark to the home page is the application's job too. The bar has no logoHref, for the same reason it has no logoSrc: it would decide the routing for everyone, and a router's own link component has to be the element that renders. Wrap the mark and name the link rather than the image:

React
<TopBar
logo={
<a href="/" aria-label="Multiconsult – til startsiden">
<img src={logoUrl} alt="" height={24} />
</a>
}
/>

The name says where the link goes, which the application name alone would not, and the empty alt keeps the image from adding a second name inside it.

beta carries no label prop: the mark reads BETA and nothing else, so the one string it shows is fixed. It is not part of a link around the mark either — the brand renders as the mark's sibling inside the slot, and takes no pointer events, so it neither joins the link's name nor swallows a click that lands on its letters.

Application content​

The bar reserves the area and does nothing with it. It is flex: 1, so it is also what gives way when the bar runs out of room. Nothing in this component can make its contents accessible — see Accessibility.

What the bar does give you is its own measure. The root carries container-type: inline-size, so a container query on a node inside the slot resolves against the width of the bar, not the viewport — the same threshold the navigation collapses on, and the reason it still behaves correctly in a shell narrower than the window:

CSS
.projectSwitcher {
display: flex;
}

@container (max-width: 900px) {
.projectSwitcher {
display: none;
}
}

Two things to know before leaning on it. The query needs a node of your own inside the slot — an element cannot query itself, and the bar is the container. And if your own markup declares container-type between the bar and that node, the query resolves against your container instead of the bar's — and naming the bar's is not a way out of it, since it is unnamed. Keep the intermediate wrappers free of container-type.

Passing the items is what renders slot 2 — there is no boolean beside it. Plenty of applications have no top-bar navigation at all, and for those, leaving navigationItems out is the whole story: an empty list renders no landmark, and no burger on its account either.

Slot 2 takes data and nothing else. Below 900px of bar width the bar hides the horizontal row and folds the same entries into the burger as rows — and it can only do that for entries it can read. There is no JSX form to reach for: the bar would have to mount a consumer's node a second time to collapse it, which is not its to do.

A data array does not cost you the router. Each entry carries component and linkProps, which go straight onto the element:

React
navigationItems={[
{ key: 'oversikt', label: 'Oversikt', active: true,
component: Link, linkProps: { to: '/oversikt' } },
]}

linkProps is deliberately untyped beyond "an object" — the element comes from your router, and TypeScript cannot tie one array entry's props to a component chosen per entry. Everything the bar owns (icon, active, status) stays fully typed.

An entry with items becomes a dropdown section instead of a link; in the collapsed panel it renders as a heading with its entries beneath, not as a nested submenu.

A section's entries take the same three fields the top level does — active, component and linkProps — because they are pages too, and a page belongs in a real link. An onClick on a button would cost the middle click, the context menu and the status-bar URL, and leave you navigating behind your own router's back:

React
navigationItems={[
{ key: 'rapporter', label: 'Rapporter', active: true, items: [
{ key: 'avvik', label: 'Avvik',
component: Link, linkProps: { to: '/rapporter/avvik' } },
{ key: 'timer', label: 'Timer', active: true,
component: Link, linkProps: { to: '/rapporter/timer' } },
]},
]}

onClick is therefore optional on a section entry: a link navigates through its own element and needs no handler. Keep onClick for an entry that acts rather than navigates — opening a dialog, say.

active survives the collapse, at both levels. A link entry becomes a row with the bar's own active fill and accent and carries aria-current="page" — which a router's Link may well set on its own, in which case the row paints without active being passed at all. A section's heading marks itself too, accent without the fill: a heading is not a row you can pick, and the two marks say different things — the heading says the current page is in here, which stays true when the entry itself has scrolled out of the panel.

TopBarNavigationItem​

PropertyTypeDescription
keystring — requiredStable identity. Do not derive it from the label — the label is translated.
labelReactNodeThe item's label.
iconReactNodeOptional leading icon, rendered at 20px.
activebooleanThe current page — or, with items, the current section.
status'info' | 'warning' | 'error'Optional 16px status badge after the label.
statusLabelstringAccessible name of the badge.
itemsTopBarNavMenuItem[]Entries under this one. Passing them makes it a dropdown section, not a link.
componentElementTypeThe element the item renders as — your router's Link. Defaults to <a>.
linkPropsobjectEverything component needs — to, href, onClick.

With TanStack Router​

createLink gives a typed link whose active state the router owns, so nothing in the application computes it:

React
import { createLink } from '@tanstack/react-router';
import { TopBarNavItem } from '@multiconsult-group-products/design-system';

const NavLink = createLink(TopBarNavItem);

Then hand NavLink to navigationItems as the component.

With react-router, component={Link} and linkProps={{ to: … }} work the same way, but active is yours to compute from useLocation.

The sub-components​

navigationItems renders these two, and both are exported: TopBarNavItem so a router wrapper like the createLink above has something to wrap, TopBarNavMenu alongside it for the section case. Each must be rendered inside a TopBar; they read the bar's Styles API from it.

TopBarNavItem renders an <a> by default. component swaps the element: component={Link} to="/prosjekter" for a router, component="button" for an item that acts rather than navigates.

Neither sub-component defaults active. Omit it and the item is simply not active — there is no false to pass, though passing it is harmless.

TopBarNavItem​

PropertyTypeDescription
childrenReactNodeThe item's label.
iconReactNodeOptional leading icon, rendered at 20px whatever size it arrives at.
activebooleanThe current page. Adds the fill, the accent colour and aria-current="page".
status'info' | 'warning' | 'error'Optional 16px status badge after the label.
statusLabelstringAccessible name of that badge. Defaults to Informasjon / Advarsel / Feil.
componentElementType — 'a'The element to render as.

TopBarNavMenu​

What a navigationItems entry with items renders as: the same item as a <button> that opens a themed Menu, for an application with more top-level sections than fit as flat links.

PropertyTypeDescription
childrenReactNodeThe trigger's label.
itemsTopBarNavMenuItem[] — requiredThe section's entries.
iconReactNodeOptional leading icon on the trigger.
activebooleanThe section holding the current page. Marked aria-current rather than page.
statusas aboveAs above, on the trigger.
statusLabelstringAs above — accessible name of the badge, defaulting to Informasjon / Advarsel / Feil.

TopBarNavMenuItem​

One entry inside a section. Shaped after TopBarNavigationItem rather than after TopBarHamburgerMenuItem — slot 10 is a list of commands, but these are pages, so they get the same link and active fields the top level has.

PropertyTypeDescription
keystring — requiredStable identity. Do not derive it from the label — the label is translated.
labelReactNodeThe entry's label.
activebooleanThe current page. Adds the active paint and aria-current="page".
componentElementTypeThe element to render as — your router's Link. Defaults to Menu.Item's own.
linkPropsobjectEverything component needs — to, href.
onClick() => voidFor an entry that acts rather than navigates. Omit it on a link.
iconReactNodeOptional leading icon.
disabledbooleanGreys the entry and stops activation. Drops component — see below.

disabled wins over component: a disabled entry renders as the plain button Menu.Item gives by default, never as your link. That is not a limitation to work around — disabled is forwarded as a DOM prop, where it stops a <button> dead and means nothing at all on an <a>, so a disabled entry that kept its element would grey out, drop out of arrow-key navigation, and then navigate anyway on a click. An entry that cannot be activated has nowhere to go.

Two details of TopBarNavMenu are not from Figma, because the nav item's variant set has no dropdown type to read them from. The caret is the system's own — the one Select and SplitButton already show. The panel opens left-aligned under its trigger and is dark in both colour schemes, like the bar and the hamburger menu.

Slot 4 is one config, the way the selector is:

TypeScript
interface TopBarSearchConfig {
label: string; // required — the accessible name
actions?: TopBarSearchAction[];
placeholder?: string; // falls back to `label`
emptyLabel?: string; // 'Ingen treff'
onQueryChange?: (query: string) => void;
}

label is required, and that is what the config buys. A search field's accessible name has to say what it searches — Søk i prosjekter, not a bare Søk — and the bar cannot know the entity. A boolean beside a loose label prop cannot demand one, so it would have to ship a default for the bars that set neither, and the only default it could ship is the generic string that rule forbids. Requiring label on a config is how slot 5 solves the same problem.

Passing the config is also what renders the slot. Its actions are not the switch: onQueryChange lets an application fetch its results as the user types, so an empty list is a legitimate resting state rather than a sign that there is nothing to search.

TypeScript
interface TopBarSearchAction {
key: string;
label: string;
description?: string;
icon?: ReactNode;
keywords?: string | string[];
group?: string;
onClick: () => void;
}

label and description are what the query is matched against; keywords adds words that match a row without being shown in it. icon is sized by the panel, so a Tabler default needs no props of its own.

The panel behind the button is Spotlight. The bar draws no field of its own: Spotlight owns the real text field, so a second one out here would be a box that looks typable and is not.

The result list is bounded and scrolls — 60% of the viewport, and never under 300px — so a query that returns two hundred rows does not grow a modal past the window. There is no prop for it: Spotlight leaves the list unbounded by default, which is not a state worth offering.

The keyboard shortcut is the platform's​

Ctrl/⌘ + K opens the bar's search from anywhere, and there is no prop to retune or disable it. That is deliberate: the platform has one search shortcut, and a config that could move it is a config that can produce a second one.

An application that already binds mod + K must give it up

Spotlight registers its shortcut per mounted <Spotlight>, not per store. So an application running a Spotlight of its own does not override the bar's — both listen, and one keystroke opens two panels stacked on each other. The bar cannot resolve this from the inside.

Release the shortcut on your own Spotlight:

React
<Spotlight store={appStore} shortcut={null} … />

Then fold whatever that panel searched into search.actions, where the bar can group it under its own heading. Slot 4's own store is separate from yours, so nothing else about your Spotlight has to change.

Spotlight is loaded only if slot 4 is used

Slot 4 sits behind a dynamic import. An application that never passes search never downloads @mantine/spotlight, and does not need its stylesheet either.

The package must still be installed — a bundler walks into the chunk to build it even where it never runs — so it stays an ordinary peer dependency. What the split removes is the weight in every other application's main chunk, not the entry in package.json.

The application must import Spotlight's stylesheet

@mantine/spotlight is a peer dependency, and its CSS is not part of this package's own:

TypeScript
import '@mantine/spotlight/styles.css';
Webpack drops that import unless you override it

@mantine/spotlight@9.6.0 ships "sideEffects": false, where every other @mantine package ships ["*.css"]. A bundler that honours the field — webpack, and Rspack with it — reads the stylesheet import as dead code and removes it, with no warning. The panel then renders with @mantine/core's Modal and Input styles and nothing of its own: the rows lose their flex layout, so each icon stacks above a label and description that run together on one line.

Override the flag for that package's CSS:

JavaScript
// webpack.config.js — module.rules
{ test: /\.css$/, include: /node_modules[\\/]@mantine[\\/]spotlight[\\/]/, sideEffects: true }

This site does exactly that, in docusaurus.config.ts. Vite is unaffected.

Selector​

TypeScript
interface TopBarSelectorConfig {
key: string; // required — React identity, and not the label
items: TopBarSelectorItem[];
label: string; // required — the accessible name
value?: string | null; // null is 'nothing chosen', and still controlled
defaultValue?: string | null;
onChange?: (key: string | null) => void;
placeholder?: string; // falls back to `label`
clearable?: boolean;
clearLabel?: string;
loading?: boolean;
loadingLabel?: string; // 'Laster'
}

interface TopBarSelectorItem {
key: string;
label: string;
}

One or an array, whichever fits. A bar with a single project picker passes the config on its own; a bar that scopes by two things passes both:

React
selectors={{ key: 'prosjekt', label: 'Velg prosjekt', items: prosjekter }}

selectors={[
{ key: 'fagomrade', label: 'Velg fagområde', items: fagomrader },
{ key: 'prosjekt', label: 'Velg prosjekt', items: prosjekter },
]}

Two is the practical ceiling. Each selector is 208px, and past that the trailing zone starves the navigation.

key is required and must not be derived from the label. The label is translated; keying on it would remount the selector on a language switch and an uncontrolled selector would lose its selection mid-switch.

The selector is deliberately dumb: it takes { key, label } and never looks at what the entries mean. Scope by region, by period, by organisation — the bar does not know the difference, and onChange hands back the key you gave it. Each config is controlled when its value is set and uncontrolled otherwise, the same split every input in the system uses.

label matters more than it looks, which is why it is required rather than defaulted. The trigger shows only the current value, so without it a screen reader announces Oslo, knapp and never says what Oslo is a choice of.

A list of one selects itself, and calls your onChange

A single entry is not a choice, so the selector takes it as chosen — and announces it through onChange rather than only displaying it, so your state matches what the bar shows. Expect that call on mount. If your handler navigates or refetches, it will do so before the user has touched anything.

clearable switches the behaviour off, and deliberately: that prop says an empty selector is a state the user may reach, which is the opposite of what the announcement asserts.

loading is for entries that arrive from a request. Passing entries is what renders the selector, which means an empty list and "not loaded yet" look identical — the bar renders nothing, and then gains a 208px control the moment the entries land, shoving everything beside it out of the way. Set loading while the request is in flight and the control holds its box from the first render, showing Laster with animated trailing dots. It wins over items, so refreshing a populated selector still reads as loading.

The loading trigger is disabled — there is nothing to open — and its accessible name is «label»: «loadingLabel», so a screen reader gets both the entity and the state. The dots are aria-hidden: read out, they are three full stops. Under prefers-reduced-motion the animation is dropped rather than collapsed, leaving all three dots visible as a static Laster...; a collapsed animation would land on its final keyframe and hide them.

Language selector​

TypeScript
interface TopBarLanguageItem {
key: string;
label: string;
shortLabel?: string;
}

type TopBarLanguagePlacement = 'topbar' | 'hamburgerMenu';

key is the code handed back to onLanguageChange, label is the language's own name in the panel (Norsk, English), and shortLabel overrides what the trigger shows when the code itself is the wrong mark. The trigger holds two characters; a longer mark widens it rather than spilling out.

Passing fewer than two languages renders no control. One language is not a choice, and an application that ships a single one has nothing to switch to.

A language that names no entry falls back to the first one — the trigger has to show some language — and says so in the console in development. The fallback would otherwise be silent, and a silent fallback means the bar displays and check-marks one language while your application believes another is on, with nothing anywhere saying the two disagree. Production pays nothing: the check folds away with NODE_ENV.

It lives in one of two places, and the application picks which. languagePlacement is 'topbar' — a 24px flat carrying the current language code with a caret beside it — or 'hamburgerMenu', which moves it into the hamburger menu as a drill-in row: the label, a chevron, and the languages in a submenu. Figma draws both forms. It is one prop with two values rather than two booleans, so "in both places" is not a state this API can express; and leaving languages empty is how a bar has no language selector at all.

'hamburgerMenu' needs nothing else. The row is itself content, so placing slot 6 in the panel is enough to render the menu trigger — even with hamburgerMenuItems empty. An application that wants the selector without a menu leaves languagePlacement at 'topbar'.

The menu row shows no current value, which is Figma's own reading: the label says what the row does, and the submenu marks which language is on. The bar's flat is the opposite — it shows the code and says nothing about what it is a code of. That is the trade between the two placements, not an inconsistency.

The trigger's accessible name is «languageLabel»: «current language» — Velg språk: Norsk. Both halves are needed. The visible mark is a two-letter code, which a screen reader spells out or mispronounces, and a name of Velg språk alone would never say which language is currently on. The rows are menuitemradio, so the current one is marked in the accessibility tree and not only by the check glyph.

Utility items​

The entries are declarative rather than a list of nodes, so the rendering stays inside the design system: the bar decides the control, its size and the dark treatment, and the application decides only the glyph, the name and what a click does.

TypeScript
interface TopBarUtilityItem {
key: string;
icon: ReactNode;
label: string;
onClick: () => void;
}

label is required and does double duty: it is the button's accessible name — these buttons carry no visible text — and the tooltip that appears below the icon on hover or focus, so a pointer user learns what the glyph means too. icon is sized to 24px by the bar, so a Tabler icon needs no props of its own.

There is no disabled on an entry, unlike TopBarHamburgerMenuItem and the message-row actions, and that is a decision rather than a gap. A menu row has visible text, so greying it out reads as "this exists, but not now" and the label says what "this" is. An icon-only button in the bar has no text to carry that: a grey glyph says nothing, and the tooltip that would explain it is exactly what a native disabled switches off. A utility button either belongs in the bar or it does not — filter the array.

Not for navigation — that is the main navigation's job, and mixing the two makes neither predictable. There is no cap on how many entries you may pass; Figma draws three, and three is the number the bar was measured for, but more is not an error — the application's own content area gives way first, since every platform control is flex: 0 0 auto.

Profile​

onProfileClick is the whole of slot 12: passing it renders the button, leaving it out renders nothing. There is no boolean beside it, because the button carries no panel of its own — unlike the bell, which has the bar's own message panel behind it — so a button with no handler would be a focusable, labelled control that does nothing when a user activates it. That is worse than an absent button, and a second prop could only ever ask for it.

The action does not migrate into the hamburger menu when the slot is off, and an application that wants a profile row there passes a hamburgerMenuItems entry of its own.

Like the utility items, the button carries a tooltip below the icon on hover or focus, showing the same profileLabel that is its accessible name. The bell and the burger deliberately do not: each opens a panel anchored directly under it, and the tooltip would be left sitting on top of that panel.

The glyph is IconUserCircle and cannot be swapped — there is no profileIcon prop, so an application that wants a real avatar in there does not have one yet.

In-app messages​

TypeScript
interface TopBarMessage {
key: string;
timestamp: string;
title: ReactNode;
excerpt: string;
read?: boolean;
onClick?: () => void;
actions?: TopBarMessageAction[];
}

interface TopBarMessageAction {
key: string;
label: ReactNode;
onClick: () => void;
variant?: 'primary' | 'secondary';
disabled?: boolean;
}
  • timestamp is a string the application has already formatted — 2 timer siden, 17.09.24 - 14:54. Not a Date: relative time needs a ticking timer and a locale, neither of which belongs to a design system that ships no date library.

  • excerpt is clamped to exactly two lines, which is why it is a plain string rather than a ReactNode — a clamp cannot be promised over arbitrary markup.

  • read lifts the row one step off the panel's flat. Unread rows keep the panel's own surface, so read is the lighter of the two.

  • onClick is how a message is opened, and the only way. Passing it renders the title as a <button> and makes the whole row the pointer target; leaving it out renders the title as inert text, which is the right shape for a row that is only an announcement. The callback is where the application opens its own modal, or routes wherever it likes.

    There is deliberately no href. A panel row is a preview, and what opening one means belongs to the application — a second way to say it could only disagree with the first, and nothing enforced that a message picked one. It is also the one place where a string from the message store would have reached the DOM as a URL. A message that genuinely lives on its own page is reached through the full inbox behind Se alle meldinger.

    The trade is a real one, and worth knowing: a <button> has no middle-click, no open-in-new-tab, no context menu and no URL in the status bar. If that matters for a particular flow, the inbox page is where it belongs.

  • actions are answerable straight from the row — at most three, secondary unless a row's one main action is marked primary. Figma's example is an invitation with Godta and Avvis.

messages turns the bell on and messageItems fills the panel — two props because an empty list is a resting state rather than a reason to drop the control: the panel shows Ingen meldinger and the badge stays away. That is what separates slot 8 from hamburgerMenuItems, navigationItems and utilityItems, where an empty list means the control has nothing to show and is not rendered — a bell with no messages is still a bell, a burger over an empty panel is a dead end.

onMarkAllRead renders the header button. Marking is all it does: the bar marks nothing itself, because the list is the application's state. Emptying the panel afterwards — the rows leaving one at a time — is the application's job too, by removing them from messageItems.

The badge counts unread rows in messageItems. Pass messageCount instead when the bar is handed only the newest few and the real total is larger; past 99 it reads 99+.

Everything older, and deleting, belongs to the full inbox behind Se alle meldinger — a page the design system does not ship. The panel is a preview of it, capped at six rows.

The panel is a Popover, not a Menu — the only dropdown in the bar that is not, and the reason is the actions. A Menu.Item renders a <button> with role="menuitem", a role whose children are presentational, so a Godta button inside one would be invalid HTML and would lose its own role in the accessibility tree. The trade is that arrow keys do not walk the rows: Tab does, which is the right key for a list of links and buttons.

Hamburger menu​

TypeScript
interface TopBarHamburgerMenuGroup {
key: string;
label?: ReactNode;
items: (TopBarHamburgerMenuItem | { type: 'language' })[];
}

interface TopBarHamburgerMenuItem {
key: string;
label: ReactNode;
onClick: () => void;
disabled?: boolean;
icon?: ReactNode;
}

The entry is the same shape SplitButton, DataTable and TopBarNavMenu take.

Entries come in groups. The groups render in the order you give them, with a divider between every two. A group can have a label, which renders as a heading above its rows and names the group for screen readers. Without a label, the divider alone separates it from the group before.

Content is what turns the slot on — there is no boolean. Passing entries renders the trigger; leaving them out renders nothing at all, because a button that opens an empty panel is worse than no button. A menu-placed language selector and onSignOut count as something to show, so the trigger can appear with hamburgerMenuItems empty.

A separate switch was tried and removed. Slot 10 is the one slot with two triggers — the wide one and the collapsed one below 900px — and a boolean that could disagree with the entries made them disagree with each other: with the menu switched off but hamburgerMenuItems filled and navigation present, the entries were absent above 900px and appeared inside the burger below it. One source removes the state that made that possible.

The trigger is a hamburger glyph that does not animate to an X. Figma's two variants carry the same mark and differ only by having the panel open, so the affordance for closing it is the panel itself — click outside it, click the trigger again, or press Escape.

When languagePlacement is 'hamburgerMenu', the language selector is a row in the panel. Put { type: 'language' } in the group where you want it; with no marker, it gets a group of its own at the end. The marker renders nothing while the selector is in the bar. The row drills into a submenu of the languages, opened by hover, by a click or tap on the row, or by ArrowRight.

When the screen is too short for the panel, the panel scrolls.

onSignOut renders the Logg ut row. The row is always the last row in the panel, in the last group, so it sits in the same place in every application. You pass what signing out does; leave the handler out and there is no row. Do not add your own sign-out entry to hamburgerMenuItems.

React
const hamburgerMenuItems: TopBarHamburgerMenuGroup[] = [
{
key: 'info',
items: [
{ key: 'help', label: 'Hjelp', icon: <IconHelp />, onClick: openHelp },
{ key: 'about', label: 'Om applikasjonen', icon: <IconInfoCircle />, onClick: openAbout },
],
},
{
key: 'account',
label: 'Konto',
items: [
{ key: 'settings', label: 'Innstillinger', icon: <IconSettings />, onClick: openSettings },
{ type: 'language' },
],
},
];

<TopBar logo={<AppLogo />} hamburgerMenuItems={hamburgerMenuItems} onSignOut={signOut} />;

The panel then reads Hjelp, Om applikasjonen, a divider, the Konto heading, Innstillinger, the language row and Logg ut.

Secondary bar​

The secondary bar is a 40px row under the bar, holding a breadcrumb trail, the application's own controls and a row of action buttons. It follows the page's colour scheme. There is no prop to switch it on: it shows when it has content.

The trail starts from the navigation. When the active entry in navigationItems is a dropdown section, the bar shows the section and its active entry, with no other prop needed. breadcrumbItems adds levels after those, to any depth:

React
<TopBar
navigationItems={[
{
key: 'kontroller',
label: 'Kontroller',
active: true,
items: [
{
key: 'observasjon',
label: 'Under observasjon',
active: true,
component: Link,
linkProps: { to: '/kontroller/observasjon' },
},
],
},
]}
breadcrumbItems={[{ key: 'k-1042', label: 'Kontroll 1042' }]}
/>

The last entry in the trail is the current page and renders as text. Other entries are links when they have component or linkProps, and plain text when they have neither. A section has no page of its own, so its entry is text.

TypeScript
interface TopBarBreadcrumbItem {
key: string;
label: ReactNode;
onClick?: () => void;
component?: ElementType;
linkProps?: object;
}

interface TopBarSecondaryAction {
key: string;
label: ReactNode;
onClick: () => void;
disabled?: boolean;
icon?: ReactNode;
}

secondaryContent takes any component — a filter field, a select. Below 900px of header width, secondaryActions fold into one menu at the right of the row.

Inherited props​

On top of the above, TopBar takes what every component in the system takes: Mantine's style props and className / style from BoxProps, classNames / styles / unstyled / vars / attributes from the Styles API, and the HTML attributes of a <header>.

Styles API​

Every part is reachable through classNames and styles, set on TopBar for the whole bar or on a single item. The sub-components style themselves through the bar's getStyles, which is why their selectors are available on TopBar too. The full set:

GroupSelectors
The barroot, bar, logo, beta, title, nav, navCollapse, hamburgerMenuWide, flexible, trailing
Secondary barsecondary, breadcrumbs, breadcrumb, secondaryContent, secondaryActions, secondaryActionsMenu
SearchsearchIcon, searchSpotlight
Selectorselector, selectorWrapper, selectorInput, selectorDropdown, selectorItem
Language selectorlanguage, languageCode, languageCaret, languageDropdown, languageItem, languageMenuItem, languageMenuDropdown
Utility and profileutilityItem, profile, actionIconGlyph
In-app messagesmessages, messagesIndicator, messagesDropdown, messagesHeader, messagesTitle, messagesList, messagesEmpty, messagesFooter, message, messageTimestamp, messageTitle, messageExcerpt, messageActions, messageButtonLabel
Hamburger menuhamburgerMenu, hamburgerMenuDropdown, hamburgerMenuScroll, hamburgerMenuItem, hamburgerMenuItemSection, hamburgerMenuSectionLabel, hamburgerMenuDivider
NavItemnavItem, navItemIcon, navItemLabel, navItemStatus
NavMenunavMenuCaret, navMenuDropdown, navMenuItem

navCollapse and hamburgerMenuWide are the two wrappers the collapse switches between — the second burger and the ordinary one. Only one of them is in the layout at any width, so styling both is how a change survives the threshold.

searchSpotlight reaches the panel's root only. The panel's own type and its action rows are themed on Spotlight itself, in style-overrides/spotlight.module.css, so a Spotlight an application runs outside the bar looks the same: the action label at 16px, and the group heading in the label type style rather than Mantine's uppercase bold. An action's leading glyph is left unsized, so it renders at whatever the icon itself is — 24px for a bare Tabler icon.

selectorDropdown and selectorItem have no CSS rule of our own behind them — that panel is the themed Menu and should stay it. They exist so an application can still reach the parts. So recolouring a status badge is an application-level change:

React
<TopBar styles={{ navItemStatus: { color: 'var(--mantine-color-purple-4)' } }} />

The badge element also carries data-status, so a class can single out one status and leave the others alone. The glyph is not overridable: status picks it, and there is no prop for a different mark.

Accessibility​

The bar is a banner landmark — a real <header> element, once per page. The main navigation is a navigation landmark nested inside it, named by navigationLabel (Hovednavigasjon unless you override it), so a screen reader user can jump straight to it instead of walking the whole bar. The platform controls are deliberately not a second navigation landmark: utility items explicitly do not navigate, and the rest of them act on the page rather than moving between pages.

The logo is the one slot whose accessible name the bar cannot supply, because the mark is a rendered element it receives and places unchanged. An <img> with no alt attribute at all announces its file name, so the attribute is never optional here — but empty is a legitimate value and usually the correct one: it declares the mark decorative, which it is whenever titleText or the page title already carries the application's name. Where the mark is the only thing naming the application, alt names it. And where the mark links to the home page, the name belongs on the link and should say where the link goes — Multiconsult – til startsiden, not Multiconsult. See Logo and title.

Search, utility items, messages, the profile button and the menu are icon-only ActionIcon buttons — the menu included: it is an ActionIcon with a hamburger glyph rather than Mantine's Burger, because the design has no X state and it shares the dark treatment, 24px glyph and focus ring of the bar's other icon buttons. Each needs an aria-label naming what it does — this project's rule is that a search field's label names the entity being searched, so Søk i prosjekter rather than a bare Søk. Slot 4 is the one that enforces it: label is required on its config, so a bar cannot turn search on without naming what it searches.

The language selector is the exception among them: it is not an icon button but the bar's own trigger, and it does carry visible text — a two-letter language code. That is too little to be a name, so the name is «languageLabel»: «current language», and the panel's rows are menuitemradio with the current one aria-checked. A screen reader therefore learns what the control chooses, which language is on, and which row is the one selected, none of which the code or the check glyph conveys on its own.

In the menu placement the row's visible label already is the entity, so the name appends only the current language — Velg språk: Norsk. It still begins with the visible text, which is what WCAG 2.5.3 asks of a name that adds to a label. The submenu opens on ArrowRight and closes on ArrowLeft or Escape, which is Mantine's own submenu contract; the click handler exists on top of that so a tap opens it too, since hover is not available on touch.

Utility items and the profile button pair that label with a tooltip carrying the same string. Both are deliberate rather than a duplication: the aria-label is the button's name and is always there, while the tooltip is what a sighted pointer user gets, and Mantine only adds aria-describedby to the button while the tooltip is open. A screen reader therefore never depends on a hover to learn what the button is. Tooltips in this system are interactive globally, which is what keeps their content reachable under WCAG 1.4.13.

The bell and the burger are the two icon buttons without one, and the reason is the panel each of them opens: it is anchored directly below the trigger, where a bottom tooltip would land on top of it — Mantine does not close a tooltip when a Popover or a Menu opens. Both carry the same aria-label as the rest, so nothing is lost for a screen reader; what a pointer user loses is a hover hint on two glyphs that mean the same thing in every application on the platform.

The bar restates the focus ring in its own accent, because the global ring is blue-6 and all but vanishes on the dark flat. That rule is scoped to the bar's descendants, so every control in it inherits a visible ring without asking for one.

The unread count reaches assistive technology as text, not as a coloured dot on an icon: the bell's name is messagesUnreadLabel(count) — 4 uleste meldinger by default, 1 ulest melding in the singular — and falls back to messagesLabel when nothing is unread. The badge itself is aria-hidden, so the number is announced once rather than twice. That is also why the label is a function and not a template: no language pluralises a count by interpolation alone.

The message rows are where the bar's own accessibility rules bite hardest. The title is the control, not the row. A row that is itself a button makes every button inside it presentational in the accessibility tree, which would silently break Godta and Avvis — so the row carries no role, no tabIndex and no key handler, and the title is the <button> that Tab reaches. The whole-row pointer target is a container onClick layered on top of that, which is the only shape Accessibility allows: the large target is an addition to a control that already works from the keyboard, never a replacement for one. The row's handler stops propagation, so a click on the title opens the message once rather than twice.

The three menu dropdowns — the selector, the hamburger menu and TopBarNavMenu — are Mantine Menus, so they come with the keyboard contract already: Enter or Space opens, the arrow keys walk the items, Escape closes, and focus returns to the trigger. None needed a key handler of its own, and none should grow one.

The messages panel is the exception, and deliberately so. It is a Popover, because its rows hold their own buttons and role="menuitem" would strip them. That gives up arrow-key navigation and gains trapFocus and returnFocus: Tab walks the panel, Escape and an outside click close it, and focus goes back to the bell. Tab is the correct key for a list of links and buttons, so this is not a lesser contract — but it does mean the panel manages its own open state, since Popover has no click-to-open of its own.

Search needs nothing of the sort, because it is one plain button and Spotlight is a modal that handles its own focus. Ctrl/⌘ + K opens the same panel from anywhere.

Spotlight is also the one overlay in the system that keeps both of Mantine's implicit exits: Escape and a click outside both close it. Every other modal has them turned off — see Modal — because those protect a half-filled form. The panel holds no work worth protecting, and it has no footer button to dismiss it with.

The active navigation item is marked with aria-current="page", not by colour alone. The bar is dark in both colour schemes, so its contrast is a single light-on-dark case measured once with APCA rather than per scheme — navigation labels and the title are content text (|Lc| 60), and the icons are non-text elements carrying information (|Lc| 30).

One pair sits knowingly below its gate, in two places. The active navigation label is --mantine-color-appheader-accent = blue-4, which measures Lc −37.2 on the bar's surface against that 60 gate for content text: Figma's Color/Text/text-link was kept over the stronger dark accent. The state is carried by aria-current="page" and by the fill behind the item, with the label's colour as a third signal rather than the only one.

The messages panel's three text buttons — Merk alle som lest, Se alle meldinger and the outlined row action — carry the same blue and the same −37.2, because Figma's drawing of the panel keeps it there. They have no aria-current to lean on, so what carries them instead is that they are buttons: a real hit area, a hover backplate and the bar's accent focus ring, rather than blue words in a paragraph. Both cases are one decision about appheader-accent, recorded here rather than hidden.

The breadcrumb trail is a second navigation landmark, named by breadcrumbsLabel, and its last entry carries aria-current="page". The menu the secondary actions fold into is named by secondaryActionsMenuLabel.

The area the application fills with children is its own space, and nothing in this component can make its contents accessible. A clickable div placed there needs the full set — role, tabIndex, an Enter and Space handler, and a label — or, better, a real control.