Nav overflow
When links or tabs do not fit, the last ones move into a "More" menu instead of scrolling off the edge. The page you are on always stays in view. On phones, More opens as a bottom sheet.
A row of links
Add data-momo-overflow to any row of tabs. Drag the corner of the dashed box to make it narrower and watch the links move into More.
<div class="docs-resize">
<nav class="tabs tabs-line" data-momo-overflow aria-label="Store" id="ov-links">
<a class="tab" href="#overview">Overview</a>
<a class="tab" href="#orders" aria-current="page">Orders</a>
<a class="tab" href="#customers">Customers</a>
<a class="tab" href="#products">Products</a>
<a class="tab" href="#invoices">Invoices</a>
<a class="tab" href="#reports">Reports</a>
<a class="tab" href="#discounts">Discounts</a>
<a class="tab" href="#settings">Settings</a>
</nav>
</div><nav class="tabs tabs-line" data-momo-overflow aria-label="Store">
<a class="tab" href="/overview">Overview</a>
<a class="tab" href="/orders" aria-current="page">Orders</a>
<a class="tab" href="/customers">Customers</a>
…
</nav>Pills, icons and counts
It works with every tab style. Icons and counts come along into the menu. data-momo-overflow="Other" changes the button's word.
<div class="docs-resize" style="width: 34rem">
<nav class="tabs tabs-pill" data-momo-overflow="Other" aria-label="Workspace" id="ov-pills">
<a class="tab" href="#home" aria-current="page"><i class="mi mi-house"></i>Home</a>
<a class="tab" href="#inbox"><i class="mi mi-inbox"></i>Inbox <span class="badge-count">12</span></a>
<a class="tab" href="#calendar"><i class="mi mi-calendar"></i>Calendar</a>
<a class="tab" href="#team"><i class="mi mi-users"></i>Team</a>
<a class="tab" href="#reports"><i class="mi mi-chart-bar"></i>Reports</a>
<a class="tab" href="#files"><i class="mi mi-folder"></i>Files <span class="badge-count">3</span></a>
<a class="tab" href="#settings"><i class="mi mi-settings"></i>Settings</a>
</nav>
</div>Real tabs
With data-momo-tabs, picking a tab from More selects it and brings it into the row. The arrow keys move between the tabs you can see.
General
Shop name, address and time zone. Customers see the name on receipts and emails.
Billing
Your plan is Team, $29 a month. The next invoice is on December 14.
Team
Six people have access. Owners can invite others and change roles.
Notifications
Email for new orders is on. Weekly summaries arrive on Monday morning.
Security
Two-step sign-in is on for everyone. The last password change was 3 weeks ago.
Integrations
Connected: the accounting app and the shipping labels. Two more are waiting for approval.
API keys
One live key, created in March. Keys are shown once, so store them somewhere safe.
<div class="docs-resize" style="width: 30rem">
<div class="tabs" data-momo-tabs data-momo-overflow aria-label="Settings" id="ov-tabs">
<button class="tab" aria-controls="ov-p-general" aria-selected="true">General</button>
<button class="tab" aria-controls="ov-p-billing">Billing</button>
<button class="tab" aria-controls="ov-p-team">Team</button>
<button class="tab" aria-controls="ov-p-notifications">Notifications</button>
<button class="tab" aria-controls="ov-p-security">Security</button>
<button class="tab" aria-controls="ov-p-integrations">Integrations</button>
<button class="tab" aria-controls="ov-p-api">API keys</button>
</div>
<div class="tab-panel" id="ov-p-general"><h3 class="mt-0">General</h3><p class="mb-0">Shop name, address and time zone. Customers see the name on receipts and emails.</p></div>
<div class="tab-panel" id="ov-p-billing" hidden><h3 class="mt-0">Billing</h3><p class="mb-0">Your plan is Team, $29 a month. The next invoice is on December 14.</p></div>
<div class="tab-panel" id="ov-p-team" hidden><h3 class="mt-0">Team</h3><p class="mb-0">Six people have access. Owners can invite others and change roles.</p></div>
<div class="tab-panel" id="ov-p-notifications" hidden><h3 class="mt-0">Notifications</h3><p class="mb-0">Email for new orders is on. Weekly summaries arrive on Monday morning.</p></div>
<div class="tab-panel" id="ov-p-security" hidden><h3 class="mt-0">Security</h3><p class="mb-0">Two-step sign-in is on for everyone. The last password change was 3 weeks ago.</p></div>
<div class="tab-panel" id="ov-p-integrations" hidden><h3 class="mt-0">Integrations</h3><p class="mb-0">Connected: the accounting app and the shipping labels. Two more are waiting for approval.</p></div>
<div class="tab-panel" id="ov-p-api" hidden><h3 class="mt-0">API keys</h3><p class="mb-0">One live key, created in March. Keys are shown once, so store them somewhere safe.</p></div>
</div><div class="tabs" data-momo-tabs data-momo-overflow aria-label="Settings">
<button class="tab" aria-controls="p-general" aria-selected="true">General</button>
<button class="tab" aria-controls="p-billing">Billing</button>
…
</div>
<div class="tab-panel" id="p-general">…</div>
<div class="tab-panel" id="p-billing" hidden>…</div>Good to know
- Items leave from the end, so put the most important ones first.
- The page or tab you are on is never moved into More.
- More is a normal dropdown menu: arrow keys, Escape, and a bottom sheet on phones.
- Without JavaScript the row simply scrolls sideways, as tabs always do.
- A column of tabs is left as it is: it never runs out of width.
- If you change the items yourself (a new count, a new link), call
Momo.overflow(row).update().
nav.addEventListener('momo:overflow', (e) => {
console.log(e.detail.hidden); // the items now in More
});Reference
| Attribute / API | What it does |
|---|---|
data-momo-overflow | On a .tabs row (any style): what does not fit moves into More |
data-momo-overflow="Other" | The button's word ("More" by default) |
Event momo:overflow | The items in More changed; detail: { hidden } |
Momo.overflow(row).update() | Measure again after you change the items |
.tabs-more, .has-more | The More button, the row while something is in More (for your own styling) |