Navigation
Top bar
The bar at the top of every screen: the product's name, its main links and a few actions. header.kui-topbar stays at the top while the page scrolls. On a phone its links move into a menu that opens without JavaScript.
The bar's links are written twice. .kui-topbar__nav holds them in the bar from 768 pixels up. details.kui-topbar__menu holds the same links in a panel for phones, and the toggle hides itself from 768 pixels up. Both copies are links to the same addresses, so nothing needs to be kept in sync by a script.
Examples
A website bar with the phone menu
Make the window narrower than 768 pixels to see the links give way to the menu button. The button opens a panel under the bar with the same links.
Porez na dohodak građana
Calculate the tax on a salary, a fee or rent in Serbia, with every step of the sum shown.
The page under the bar scrolls; the bar stays at the top.
<header class="kui-topbar">
<div class="kui-container kui-container--full kui-topbar__row">
<a class="kui-topbar__brand" href="#topbar-home"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#scale"></use></svg><span>Pravo i porez</span></a>
<nav class="kui-topbar__nav" aria-label="Main">
<a class="kui-navlink" href="#topbar-calc" aria-current="page">Calculators</a>
<a class="kui-navlink" href="#topbar-guides">Guides</a>
<a class="kui-navlink" href="#topbar-deadlines">Deadlines</a>
<a class="kui-navlink" href="#topbar-pricing">Pricing</a>
</nav>
<div class="kui-topbar__end">
<a class="kui-button kui-button--strong kui-button--sm" href="#topbar-start">Sign in</a>
</div>
<details class="kui-topbar__menu">
<summary aria-label="Menu"><svg class="kui-icon kui-icon--open" aria-hidden="true"><use href="kit/icons.svg#menu"></use></svg><svg class="kui-icon kui-icon--close" aria-hidden="true"><use href="kit/icons.svg#x"></use></svg></summary>
<nav class="kui-topbar__panel" aria-label="Main, menu">
<a class="kui-navlink" href="#topbar-calc" aria-current="page">Calculators</a>
<a class="kui-navlink" href="#topbar-guides">Guides</a>
<a class="kui-navlink" href="#topbar-deadlines">Deadlines</a>
<a class="kui-navlink" href="#topbar-pricing">Pricing</a>
</nav>
</details>
</div>
</header>
<div class="kui-container kui-container--full kui-stack" style="padding-block: var(--kui-space-7)">
<h4 class="kui-h4">Porez na dohodak građana</h4>
<p class="kui-text-muted">Calculate the tax on a salary, a fee or rent in Serbia, with every step of the sum shown.</p>
<p class="kui-text-muted">The page under the bar scrolls; the bar stays at the top.</p>
</div>
An application bar
An application keeps its sections in the side navigation, so the bar holds the workspace name, search and the person’s own actions. Icon-only buttons carry an aria-label.
<header class="kui-topbar">
<div class="kui-container kui-container--full kui-topbar__row">
<a class="kui-topbar__brand" href="#topbar-app"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#layers"></use></svg><span>Kancelarija Đorđević</span></a>
<div class="kui-topbar__end" style="margin-left: auto">
<button class="kui-button kui-button--icon kui-button--ghost" type="button" aria-label="Search"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#search"></use></svg></button>
<button class="kui-button kui-button--icon kui-button--ghost" type="button" aria-label="Notifications, 3 new"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#bell"></use></svg></button>
<span class="kui-avatar kui-avatar--sm" role="img" aria-label="Milica Šarić">MŠ</span>
</div>
</div>
</header>
States
Every state
The current page's link carries aria-current="page" and gets the soft fill. Hover gives the same fill to any link; keyboard focus shows the ring. The menu toggle swaps its icon from menu to close while the panel is open. A long product name does not wrap: it ends in an ellipsis before the actions are pushed out, so keep it short.
<header class="kui-topbar">
<div class="kui-container kui-container--full kui-topbar__row">
<a class="kui-topbar__brand" href="#topbar-s-home"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#landmark"></use></svg><span>Opština</span></a>
<nav class="kui-topbar__nav" aria-label="States">
<a class="kui-navlink" href="#topbar-s-a" aria-current="page">Current</a>
<a class="kui-navlink" href="#topbar-s-b">Default</a>
<a class="kui-navlink" href="#topbar-s-c"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#external-link"></use></svg><span>With an icon</span></a>
</nav>
<details class="kui-topbar__menu" open>
<summary aria-label="Menu, states"><svg class="kui-icon kui-icon--open" aria-hidden="true"><use href="kit/icons.svg#menu"></use></svg><svg class="kui-icon kui-icon--close" aria-hidden="true"><use href="kit/icons.svg#x"></use></svg></summary>
<nav class="kui-topbar__panel" aria-label="States, menu">
<a class="kui-navlink" href="#topbar-s-a" aria-current="page">Current</a>
<a class="kui-navlink" href="#topbar-s-b">Default</a>
<a class="kui-navlink" href="#topbar-s-c"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#external-link"></use></svg><span>With an icon</span></a>
</nav>
</details>
</div>
</header>
<div class="kui-container kui-container--full" style="min-height: calc(var(--kui-space-8) * 4)"></div>
Classes and attributes
header.kui-topbar- The bar. Sticky at the top, with a divider under it and a blurred, slightly see-through background.
.kui-topbar__row- The row inside a .kui-container: brand, links, actions and the menu toggle.
.kui-topbar__brand- The product mark and name, a link to the start page.
.kui-topbar__nav- The links for wide screens; hidden under 768 pixels.
.kui-navlink- One link of the bar. aria-current="page" marks the current one.
.kui-topbar__end- The actions at the end of the row: buttons, the theme picker, the avatar.
details.kui-topbar__menu- The phone menu. Its summary holds two icons, .kui-icon--open and .kui-icon--close, and an aria-label. Hidden from 768 pixels up.
.kui-topbar__panel- The panel the menu opens: a nav with the same links, full width under the bar.
Keyboard
- Tab
- Moves through the brand, the links and the actions in order.
- Enter or Space
- On the menu toggle, opens or closes the panel.
- Enter
- Follows a link.
Accessibility
- Put the bar in a
<header>outside<main>; it is then the page's banner landmark. - Each
<nav>has its own aria-label, so a screen reader lists “Main” and “Main, menu” apart from other navigation on the page. - The current page is marked with
aria-current="page", which is read out; the fill is only what the eye sees. - The menu toggle is a native
<summary>: it is a button to assistive technology and says whether it is expanded. - Put a skip link before the bar so a keyboard user can jump to the content.
Do and do not
Do
- Keep the bar to four or five links; put the rest in the footer or a menu.
- Write the same links, in the same order, in the bar and in the phone menu.
- Put the one main action (Start, Sign in) at the end of the row.
Do not
- Do not hide the main links behind the menu on a wide screen.
- Do not put a search field and five links and three buttons in one bar: it will not fit on a tablet.
- Do not make the bar taller than it needs to be; it covers the page while scrolling.