Tab bar
The row of main sections at the bottom of a phone app — where the thumb already is. Three to five places people go all the time, always one tap away. It makes an installed web app feel like an app instead of a website.
<nav class="tabbar" aria-label="Main">
<a class="tabbar-item" href="#home" aria-current="page"><i class="mi mi-house"></i><span>Home</span></a>
<a class="tabbar-item" href="#inbox"><i class="mi mi-inbox"></i><span>Inbox</span></a>
<a class="tabbar-item" href="form-layout#orders"><i class="mi mi-shopping-bag"></i><span>Orders</span></a>
<a class="tabbar-item" href="#me"><i class="mi mi-user"></i><span>Me</span></a>
</nav>
Add it to your app, step by step
- Let the page reach the edges of the phone. Add
viewport-fit=coverto your viewport tag. Without it, iPhones keep a blank strip under the bar instead of letting it sit over the home indicator (Moey keeps the buttons clear of it).<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> - Pick three to five places. The sections people use every day — not everything. Settings, help and the rest go in a "Me" or "More" tab.
- Add the bar as the last thing in
<body>(or inside your.app), with an icon and a short label per tab. Use<a>for pages and<button>for actions. - Mark where we are with
aria-current="page". If you don't, Moey marks the tab whose link matches the address; in single-page apps tapping a tab moves the mark. - That's it. The page gets bottom padding so nothing hides under the bar, toasts float above it, and it steps aside while the keyboard is up. From 1024px wide it disappears — the sidebar or navbar takes over (keep it with
.tabbar-always).
Badges
A .tabbar-badge in a tab shows a count; an empty one is a small dot ("something new"). Give a dot an aria-label so screen readers hear it.
<a class="tabbar-item" href="/inbox"><i class="mi mi-inbox"></i><span>Inbox</span><span class="tabbar-badge">12</span></a>
<a class="tabbar-item" href="/alerts"><i class="mi mi-bell"></i><span>Alerts</span><span class="tabbar-badge" aria-label="New"></span></a>
A big middle button
For the one thing people do most — a new post, a scan, a sale. .tabbar-action on a button in the middle: a round brand-colored button whose label is kept for screen readers only.
<button class="tabbar-item tabbar-action" data-moey-open="#newOrder">
<i class="mi mi-plus"></i><span>New order</span>
</button>
Floating, and hiding on scroll
.tabbar-floating lifts it into a rounded pill. data-moey-hide-on-scroll slides it away while scrolling down (more room to read) and brings it back on the way up, at the top and at the end of the page.
- AKOrder #104301 item
- BKOrder #104292 items
- CKOrder #104283 items
- DKOrder #104274 items
- EKOrder #104265 items
- FKOrder #104256 items
- GKOrder #104247 items
- HKOrder #104238 items
- IKOrder #104229 items
- JKOrder #1042110 items
- KKOrder #1042011 items
- LKOrder #1041912 items
- MKOrder #1041813 items
- NKOrder #1041714 items
- AKOrder #104301 item
- BKOrder #104292 items
- CKOrder #104283 items
- DKOrder #104274 items
- EKOrder #104265 items
- FKOrder #104256 items
- GKOrder #104247 items
- HKOrder #104238 items
- IKOrder #104229 items
- JKOrder #1042110 items
- KKOrder #1042011 items
- LKOrder #1041912 items
- MKOrder #1041813 items
- NKOrder #1041714 items
<nav class="tabbar tabbar-floating" aria-label="Main">…</nav>
<nav class="tabbar" data-moey-hide-on-scroll aria-label="Main">…</nav>
With the app shell
Phones get the tab bar, wide screens the sidebar — the same sections in both. Put the bar inside the .app; the ☰ sidebar drawer still works for the rest of the menu.
<div class="app">
<aside class="app-sidebar" popover>…all sections…</aside>
<div class="app-main">
<header class="app-topbar">…</header>
<main class="app-content">…</main>
</div>
<nav class="tabbar" aria-label="Main">…the 4 main sections…</nav>
</div>
Accessible
- It is a
<nav>landmark — give it anaria-label("Main"). - The current tab is announced ("current page"), and colored — not by color alone: it's the only tab in the brand color, and the label stays.
- Tabs are 56px tall and share the full width: big, easy targets.
- It never covers content: the page's bottom padding is set for you (
--mo-tabbar-space).
Reference
| Class / attribute | What it does |
|---|---|
.tabbar | The bar: fixed to the bottom below 1024px, with room for the home indicator |
.tabbar-item (a or button) + aria-current="page" | A tab — an icon and a short label; the current one is marked (and set for you when missing) |
.tabbar-badge | A count, or a dot when empty |
.tabbar-action | The big round middle button (its label is visually hidden) |
.tabbar-floating · .tabbar-always | A rounded floating pill · stays on wide screens too |
data-moey-hide-on-scroll | Slides away while scrolling down |
data-moey-no-current | On a tab: tapping it doesn't move the mark (it opens something) |
--mo-tabbar-space | Read-only: the room the bar takes (the page and toasts use it; 0 when there's no bar) |