Components
Tabs
Switch between views without leaving the page. Each tab shows the panel in the same position — no ids to wire up — and a smooth indicator slides to the selected tab.
Revenue is up 12% this month. Most orders came in on weekdays.
3 orders need attention — payments are still pending after 48 hours.
932 customers, 48 new this week.
Billing
<div class="tabs">
<div class="tab-list">
<button class="tab"><i class="mi mi-layout-dashboard"></i>Overview</button>
<button class="tab">Orders <span class="badge badge-count">3</span></button>
<button class="tab" disabled>Billing</button>
</div>
<div class="tab-panel">…</div>
<div class="tab-panel">…</div>
<div class="tab-panel">…</div>
</div>
With moey.js: the first tab starts selected (or the one with aria-selected="true"); ← → (↑ ↓ when vertical), Home and End move between tabs; disabled tabs are skipped; a long tab row scrolls and keeps the selected tab in view. Screen-reader roles and links are added for you.
Styles
Revenue is up 12% this month. Most orders came in on weekdays.
3 orders need attention — payments are still pending after 48 hours.
932 customers, 48 new this week.
Billing
Revenue is up 12% this month. Most orders came in on weekdays.
3 orders need attention — payments are still pending after 48 hours.
932 customers, 48 new this week.
Billing
Revenue is up 12% this month. Most orders came in on weekdays.
3 orders need attention — payments are still pending after 48 hours.
932 customers, 48 new this week.
Billing
Revenue is up 12% this month. Most orders came in on weekdays.
3 orders need attention — payments are still pending after 48 hours.
932 customers, 48 new this week.
Billing
Revenue is up 12% this month. Most orders came in on weekdays.
3 orders need attention — payments are still pending after 48 hours.
932 customers, 48 new this week.
Billing
| Class | What it does |
|---|---|
| (default) | Underline tabs — a bar under the selected tab |
.tabs-pills | The selected tab gets a soft tinted background |
.tabs-segmented | A tray with a raised selected tab — for switching views |
.tabs-vertical | The tab list on the side (a row again on phones) |
.tabs-fill | Equal-width tabs that fill the row |
.tabs-sm | Smaller tabs |
theme-* | Colors the indicator / selected pill |
From code & events
<button class="tab" aria-controls="settings-panel"> <!-- a panel somewhere else on the page -->
tabs.addEventListener('moey:tab', (e) => {
console.log(e.detail.index, e.detail.panel);
// e.preventDefault() keeps the current tab (e.g. unsaved changes)
});
Moey.tab(document.querySelector('#orders-tab')); // select a tab
Colors
Add theme-<color> to the tabs to color the indicator (and the pill in .tabs-pills).
<div class="tabs theme-green">…</div>
<div class="tabs tabs-pills theme-purple">…</div>
Inside a card
Tabs as the card header — a common dashboard pattern.
- Revenue
- $48,210
- Orders
- 1,284
- Refunds
- 0.9%
12 orders need attention.
4.8 average from 213 reviews.
<div class="card"><div class="card-body">
<div class="tabs">
<div class="tab-list">
<button class="tab">Overview</button>
<button class="tab">Orders <span class="badge badge-count">12</span></button>
<button class="tab">Reviews</button>
</div>
<div class="tab-panel">
<dl class="dl dl-grid">
<div><dt>Revenue</dt><dd>$48,210</dd></div>
<div><dt>Orders</dt><dd>1,284</dd></div>
<div><dt>Refunds</dt><dd>0.9%</dd></div>
</dl>
</div>
<div class="tab-panel">12 orders need attention.</div>
<div class="tab-panel">4.8 average from 213 reviews.</div>
</div>
</div></div>
Many tabs
When they don’t fit, the row scrolls sideways — and keeps the selected tab in view.
General settings
Branding settings
Checkout settings
Shipping settings
Taxes settings
Payments settings
Notifications settings
Domains settings
Team settings
<div class="tabs">
<div class="tab-list">
<button class="tab">General</button>
…
<button class="tab">Team</button>
</div>
<div class="tab-panel">…</div>…
</div>