Navigation
Tab bar
The row of three to five main sections at the bottom of a phone screen. nav.kui-tabbar holds links with an icon over a short name; it stays at the bottom while the page scrolls and leaves room for the phone's home bar.
Add .kui-tabbar--phone and the bar hides itself from 768 pixels up, where the side navigation or the top bar carries the same links. The examples here leave it out so the bar shows at every width.
Examples
Four sections, one with a count
The current section has its icon in a soft pill. A count of new items sits on the icon; its words are in the link for screen readers.
Danas
Three hearings and a filing deadline. The tab bar stays at the bottom of the screen.
<div class="kui-container kui-stack" style="padding-block: var(--kui-space-6)">
<h4 class="kui-h4">Danas</h4>
<p class="kui-text-muted">Three hearings and a filing deadline. The tab bar stays at the bottom of the screen.</p>
</div>
<nav class="kui-tabbar" aria-label="Main">
<a class="kui-tabbar__item" href="#tabbar-today" aria-current="page"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#house"></use></svg><span>Today</span></a>
<a class="kui-tabbar__item" href="#tabbar-cases"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#briefcase"></use></svg><span>Cases</span></a>
<a class="kui-tabbar__item" href="#tabbar-inbox"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#inbox"></use></svg><span class="kui-tabbar__badge" aria-hidden="true">3</span><span>Inbox</span><span class="kui-visually-hidden">, 3 new</span></a>
<a class="kui-tabbar__item" href="#tabbar-me"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#user"></use></svg><span>Profile</span></a>
</nav>
Five sections with long names
Five is the most a phone holds. A name too long for its share of the width ends in an ellipsis; the full name stays the accessible name.
<nav class="kui-tabbar" aria-label="Main, five sections">
<a class="kui-tabbar__item" href="#tabbar-5a"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#house"></use></svg><span>Početna</span></a>
<a class="kui-tabbar__item" href="#tabbar-5b" aria-current="page"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#calculator"></use></svg><span>Kalkulatori</span></a>
<a class="kui-tabbar__item" href="#tabbar-5c"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#calendar-check"></use></svg><span>Rokovi</span></a>
<a class="kui-tabbar__item" href="#tabbar-5d"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#book-open"></use></svg><span>Steuererklärungen</span></a>
<a class="kui-tabbar__item" href="#tabbar-5e"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#settings"></use></svg><span>Podešavanja</span></a>
</nav>
States
Every state
Current: aria-current="page" colours the name and puts the icon in the accent pill. Hover darkens the name. Focus shows the ring inside the item. Each item is at least 44 pixels tall plus a margin, and the bar adds the phone's safe area at the bottom.
<nav class="kui-tabbar" aria-label="States">
<a class="kui-tabbar__item" href="#tabbar-s1" aria-current="page"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#star"></use></svg><span>Current</span></a>
<a class="kui-tabbar__item" href="#tabbar-s2"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#circle"></use></svg><span>Default</span></a>
<a class="kui-tabbar__item" href="#tabbar-s3"><svg class="kui-icon" aria-hidden="true"><use href="kit/icons.svg#bell"></use></svg><span class="kui-tabbar__badge" aria-hidden="true">99+</span><span>With a count</span><span class="kui-visually-hidden">, 99 or more new</span></a>
</nav>
Classes and attributes
nav.kui-tabbar- The bar. Sticky at the bottom, with the safe area of the phone below it. Give it an aria-label.
--phone- Hides the bar from 768 pixels up.
.kui-tabbar__item- One link: an icon and a span with the name. aria-current="page" marks the current one.
.kui-tabbar__badge- A count over the icon. aria-hidden, with the same fact in visually hidden words in the link.
.kui-app > .kui-tabbar- Inside the application frame the bar takes the bottom row.
Keyboard
- Tab
- Moves from section to section.
- Enter
- Opens the section.
Accessibility
- Use links in a
<nav>, not role="tablist": each item goes to another page, it does not switch a panel. - Mark the current section with
aria-current="page". - Every item has a visible name under its icon. An icon alone is not enough on a tab bar.
- The count is hidden from screen readers as a number on its own and said again in words (“3 new”) inside the link.
- Each item is at least 44 by 44 pixels, so it can be pressed with a thumb.
Do and do not
Do
- Use three to five items.
- Keep the names to one short word.
- Keep the same items on every screen of the app.
Do not
- Do not put actions such as “New” in the tab bar.
- Do not hide the bar while a person scrolls: they lose the way back.
- Do not use it next to a side navigation on the same screen width.