Skip to content
v0.9.1
Components

Tabs

Switch between views in the same place. The chosen tab is a solid ink block; the others show an outline on hover.

Basic

A row of .tab buttons in .tabs with data-momo-tabs. Each tab names its panel with aria-controls. Put hidden on the panels that start closed. Try the arrow keys.

All 12 tasks for this sprint.

<div class="tabs" data-momo-tabs aria-label="Tasks">
  <button class="tab" aria-controls="tb-all" aria-selected="true">All tasks</button>
  <button class="tab" aria-controls="tb-pending">Pending</button>
  <button class="tab" aria-controls="tb-done">Done</button>
</div>
<div class="tab-panel" id="tb-all"><p>All 12 tasks for this sprint.</p></div>
<div class="tab-panel" id="tb-pending" hidden><p>5 tasks are waiting.</p></div>
<div class="tab-panel" id="tb-done" hidden><p>7 tasks are done. Nice.</p></div>

Boxed

.tabs-boxed puts the tabs in one bordered box, like a segmented switch. Add .tabs-block to fill the width.

<div class="tabs tabs-boxed" data-momo-tabs aria-label="Billing period">
  <button class="tab" aria-selected="true">Monthly</button>
  <button class="tab">Yearly <span class="badge badge-cyan">-20%</span></button>
</div>
<div class="tabs tabs-boxed tabs-block" data-momo-tabs aria-label="View">
  <button class="tab" aria-selected="true"><i class="mi mi-list"></i> List</button>
  <button class="tab"><i class="mi mi-layout-grid"></i> Board</button>
  <button class="tab"><i class="mi mi-calendar"></i> Calendar</button>
</div>

Tabs without panels work as filters: listen for momo:tab and update your list.

Pill

.tabs-pill makes each tab a bordered chip. On phones the row scrolls sideways and the chosen tab slides into view.

<div class="tabs tabs-pill" data-momo-tabs aria-label="Inbox filter">
  <button class="tab" aria-selected="true">All</button>
  <button class="tab">Mentions <span class="badge-count">3</span></button>
  <button class="tab">System</button>
  <button class="tab">Comments</button>
  <button class="tab">Archived</button>
</div>

Line

.tabs-line is the quiet version: an ink rule with a thick bar under the chosen tab.

Constanza marked 2 tasks as complete.

<div class="tabs tabs-line" data-momo-tabs aria-label="Profile">
  <button class="tab" aria-controls="tl-up" aria-selected="true">Updates</button>
  <button class="tab" aria-controls="tl-tasks">Tasks</button>
  <button class="tab" aria-controls="tl-stats">Statistics</button>
</div>
<div class="tab-panel" id="tl-up"><p>Constanza marked 2 tasks as complete.</p></div>
<div class="tab-panel" id="tl-tasks" hidden><p>3 open tasks.</p></div>
<div class="tab-panel" id="tl-stats" hidden><p>53 of 70 tasks done this month.</p></div>

Colors and size

.tabs-brand or .tabs-<color> fills the chosen tab with a color. .tabs-sm is smaller.

<div class="tabs tabs-brand" data-momo-tabs aria-label="Brand tabs">
  <button class="tab" aria-selected="true">Overview</button>
  <button class="tab">Sales</button>
  <button class="tab">Customers</button>
</div>
<div class="tabs tabs-pill tabs-violet tabs-sm" data-momo-tabs aria-label="Small violet tabs">
  <button class="tab">Day</button>
  <button class="tab" aria-selected="true">Week</button>
  <button class="tab">Month</button>
</div>

Vertical

Put .tabs-vertical and the panels in a .tabs-layout: a side menu on wide screens, a scrolling row on phones. Use the up and down arrow keys. Every style works sideways: plain, .tabs-boxed, .tabs-pill, .tabs-line and .tabs-card.

Account

Name, email and password.

<div class="tabs-layout">
  <div class="tabs tabs-vertical" data-momo-tabs aria-label="Settings">
    <button class="tab" aria-controls="tv-account" aria-selected="true"><i class="mi mi-user"></i> Account</button>
    <button class="tab" aria-controls="tv-notify"><i class="mi mi-bell"></i> Notifications <span class="badge badge-count">3</span></button>
    <button class="tab" aria-controls="tv-privacy"><i class="mi mi-shield"></i> Privacy</button>
    <button class="tab" aria-controls="tv-billing"><i class="mi mi-credit-card"></i> Billing</button>
  </div>
  <div>
    <div class="tab-panel" id="tv-account"><h3 class="h5">Account</h3><p>Name, email and password.</p></div>
    <div class="tab-panel" id="tv-notify" hidden><h3 class="h5">Notifications</h3><p>Choose what we tell you about.</p></div>
    <div class="tab-panel" id="tv-privacy" hidden><h3 class="h5">Privacy</h3><p>Who can see your profile.</p></div>
    <div class="tab-panel" id="tv-billing" hidden><h3 class="h5">Billing</h3><p>Your plan and invoices.</p></div>
  </div>
</div>

Boxed, pill and line, sideways

<div class="grid md:grid-cols-3 gap-6">
  <div class="tabs tabs-boxed tabs-vertical-always" data-momo-tabs aria-label="Boxed">
    <button class="tab" aria-selected="true"><i class="mi mi-house"></i> Home</button>
    <button class="tab"><i class="mi mi-inbox"></i> Inbox</button>
    <button class="tab"><i class="mi mi-settings"></i> Settings</button>
  </div>
  <div class="tabs tabs-pill tabs-brand tabs-vertical-always" data-momo-tabs aria-label="Pill">
    <button class="tab" aria-selected="true">Overview</button>
    <button class="tab">Activity</button>
    <button class="tab">Members</button>
  </div>
  <div class="tabs tabs-line tabs-vertical-always" data-momo-tabs aria-label="Line">
    <button class="tab" aria-selected="true">General</button>
    <button class="tab">Security</button>
    <button class="tab">Advanced</button>
  </div>
</div>

.tabs-vertical-always stays a column on phones too. .tabs-vertical (inside .tabs-layout) turns into a row there.

With a description

Put the name and a <small> in a <span>: the small text goes on a second line. Good for settings and onboarding steps.

Profile

How others see you.

<div class="tabs-layout" style="--tabs-side: 16rem">
  <div class="tabs tabs-boxed tabs-vertical" data-momo-tabs aria-label="Workspace settings">
    <button class="tab" aria-controls="td-profile" aria-selected="true"><i class="mi mi-user"></i><span>Profile<small>Name, photo, bio</small></span></button>
    <button class="tab" aria-controls="td-look"><i class="mi mi-palette"></i><span>Appearance<small>Theme and colors</small></span></button>
    <button class="tab" aria-controls="td-security"><i class="mi mi-lock"></i><span>Security<small>Password, two-step sign in</small></span></button>
  </div>
  <div>
    <div class="tab-panel" id="td-profile"><h3 class="h5">Profile</h3><p>How others see you.</p></div>
    <div class="tab-panel" id="td-look" hidden><h3 class="h5">Appearance</h3><p>Light, dark, or follow the system.</p></div>
    <div class="tab-panel" id="td-security" hidden><h3 class="h5">Security</h3><p>Keep your account safe.</p></div>
  </div>
</div>

On the right, and sticky

.tabs-layout-end puts the menu on the right. .tabs-sticky keeps it in view while a long panel scrolls (--tabs-top sets the gap from the top, for example under a sticky navbar). --tabs-side sets the menu width.

Introduction

A short tour of what is inside, and who it is for.

<div class="tabs-layout tabs-layout-end">
  <div class="tabs tabs-line tabs-vertical tabs-sticky" data-momo-tabs aria-label="Article parts">
    <button class="tab" aria-controls="te-intro" aria-selected="true">Introduction</button>
    <button class="tab" aria-controls="te-setup">Setup</button>
    <button class="tab" aria-controls="te-faq">Questions</button>
  </div>
  <div>
    <div class="tab-panel" id="te-intro"><h3 class="h5">Introduction</h3><p>A short tour of what is inside, and who it is for.</p></div>
    <div class="tab-panel" id="te-setup" hidden><h3 class="h5">Setup</h3><p>Three steps and you are done.</p></div>
    <div class="tab-panel" id="te-faq" hidden><h3 class="h5">Questions</h3><p>The ones people ask most.</p></div>
  </div>
</div>

Card (folder) tabs

.tabs-card: the chosen tab joins the box under it, like a folder tab. Put the panels in .tabs-card-body. Works sideways too.

Order #1042: 3 items, $124.00, paid by card.

<div>
  <div class="tabs tabs-card" data-momo-tabs aria-label="Order">
    <button class="tab" aria-controls="tc-details" aria-selected="true">Details</button>
    <button class="tab" aria-controls="tc-shipping">Shipping</button>
    <button class="tab" aria-controls="tc-notes">Notes <span class="badge badge-count">2</span></button>
  </div>
  <div class="tabs-card-body">
    <div class="tab-panel" id="tc-details"><p class="m-0">Order #1042: 3 items, $124.00, paid by card.</p></div>
    <div class="tab-panel" id="tc-shipping" hidden><p class="m-0">Ships Tuesday with tracking.</p></div>
    <div class="tab-panel" id="tc-notes" hidden><p class="m-0">Gift wrap, no receipt in the box.</p></div>
  </div>
</div>

Summary

On track: 12 of 18 tasks done.

<div class="tabs-layout">
  <div class="tabs tabs-card tabs-vertical" data-momo-tabs aria-label="Project">
    <button class="tab" aria-controls="tcv-summary" aria-selected="true"><i class="mi mi-layout-dashboard"></i> Summary</button>
    <button class="tab" aria-controls="tcv-stats"><i class="mi mi-chart-bar"></i> Stats</button>
    <button class="tab" aria-controls="tcv-chat"><i class="mi mi-message-circle"></i> Chat</button>
  </div>
  <div class="tabs-card-body">
    <div class="tab-panel" id="tcv-summary"><h3 class="h5">Summary</h3><p>On track: 12 of 18 tasks done.</p></div>
    <div class="tab-panel" id="tcv-stats" hidden><h3 class="h5">Stats</h3><p>Average task: 2.4 days.</p></div>
    <div class="tab-panel" id="tcv-chat" hidden><h3 class="h5">Chat</h3><p>3 new messages.</p></div>
  </div>
</div>

Colors

Add .tabs-card-<color> to the tab row: the chosen tab and the box take the pop color. .tabs-card-<color>-soft uses the soft tint instead.

Flour, butter, a pinch of salt.

Three days in Porto.

<div class="grid md:grid-cols-2 gap-6">
  <div>
    <div class="tabs tabs-card tabs-card-yellow" data-momo-tabs aria-label="Recipe">
      <button class="tab" aria-controls="tk-ingredients" aria-selected="true">Ingredients</button>
      <button class="tab" aria-controls="tk-steps">Steps</button>
    </div>
    <div class="tabs-card-body">
      <div class="tab-panel" id="tk-ingredients"><p class="m-0">Flour, butter, a pinch of salt.</p></div>
      <div class="tab-panel" id="tk-steps" hidden><p class="m-0">Mix, rest, bake for 25 minutes.</p></div>
    </div>
  </div>
  <div>
    <div class="tabs tabs-card tabs-card-cyan-soft" data-momo-tabs aria-label="Trip">
      <button class="tab" aria-controls="tk-plan" aria-selected="true">Plan</button>
      <button class="tab" aria-controls="tk-packing">Packing</button>
    </div>
    <div class="tabs-card-body">
      <div class="tab-panel" id="tk-plan"><p class="m-0">Three days in Porto.</p></div>
      <div class="tab-panel" id="tk-packing" hidden><p class="m-0">Rain jacket, good shoes.</p></div>
    </div>
  </div>
</div>

Or give each tab its own color with .tab-<color>, like folder dividers: the others show a light tint, and the box takes the color of the chosen one.

Ideas

A sticker pack for the shop, and a winter sale.

<div>
  <div class="tabs tabs-card" data-momo-tabs aria-label="Notebook">
    <button class="tab tab-pink" aria-controls="tn-ideas" aria-selected="true"><i class="mi mi-sparkles"></i> Ideas</button>
    <button class="tab tab-lime" aria-controls="tn-todo"><i class="mi mi-check"></i> To do</button>
    <button class="tab tab-cyan" aria-controls="tn-done"><i class="mi mi-archive"></i> Done</button>
    <button class="tab tab-violet" aria-controls="tn-later"><i class="mi mi-clock"></i> Later</button>
  </div>
  <div class="tabs-card-body">
    <div class="tab-panel" id="tn-ideas"><h3 class="h5">Ideas</h3><p class="m-0">A sticker pack for the shop, and a winter sale.</p></div>
    <div class="tab-panel" id="tn-todo" hidden><h3 class="h5">To do</h3><p class="m-0">Order mailers, update the price list.</p></div>
    <div class="tab-panel" id="tn-done" hidden><h3 class="h5">Done</h3><p class="m-0">New product photos.</p></div>
    <div class="tab-panel" id="tn-later" hidden><h3 class="h5">Later</h3><p class="m-0">A second shop in spring.</p></div>
  </div>
</div>

Profile

Name, photo and bio.

<div class="tabs-layout">
  <div class="tabs tabs-card tabs-vertical" data-momo-tabs aria-label="Account areas">
    <button class="tab tab-yellow" aria-controls="tq-profile" aria-selected="true"><i class="mi mi-user"></i> Profile</button>
    <button class="tab tab-orange" aria-controls="tq-billing"><i class="mi mi-credit-card"></i> Billing</button>
    <button class="tab tab-green" aria-controls="tq-team"><i class="mi mi-users"></i> Team</button>
  </div>
  <div class="tabs-card-body">
    <div class="tab-panel" id="tq-profile"><h3 class="h5">Profile</h3><p class="m-0">Name, photo and bio.</p></div>
    <div class="tab-panel" id="tq-billing" hidden><h3 class="h5">Billing</h3><p class="m-0">Plan, card and invoices.</p></div>
    <div class="tab-panel" id="tq-team" hidden><h3 class="h5">Team</h3><p class="m-0">4 people, 2 invites waiting.</p></div>
  </div>
</div>

Fill a box or the screen

.tabs-fill makes tabs take the whole height of their box: the tab row stays put and only the panel scrolls. Give the box a height, or add .tabs-fill-screen for the full screen (an app page, a full-screen dialog). .tabs-fill-side puts the tabs in a side column (a row on phones).

Inbox

Only this part scrolls. The tabs stay where they are.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis dapibus.

Cras mattis consectetur purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla.

Maecenas faucibus mollis interdum. Vestibulum id ligula porta felis euismod semper.

Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur.

Etiam porta sem malesuada magna mollis euismod. Curabitur blandit tempus porttitor.

<div class="border rounded overflow-hidden" style="height: 22rem">
  <div class="tabs-fill tabs-fill-side">
    <div class="tabs" data-momo-tabs aria-label="Mail">
      <button class="tab" aria-controls="tf-inbox" aria-selected="true"><i class="mi mi-inbox"></i> Inbox <span class="badge badge-count ms-auto">12</span></button>
      <button class="tab" aria-controls="tf-sent"><i class="mi mi-message-circle"></i> Sent</button>
      <button class="tab" aria-controls="tf-settings"><i class="mi mi-settings"></i> Settings</button>
    </div>
    <div class="tab-panels">
      <div class="tab-panel" id="tf-inbox">
        <h3 class="h5">Inbox</h3>
        <p>Only this part scrolls. The tabs stay where they are.</p>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis dapibus.</p>
        <p>Cras mattis consectetur purus sit amet fermentum. Donec ullamcorper nulla non metus auctor fringilla.</p>
        <p>Maecenas faucibus mollis interdum. Vestibulum id ligula porta felis euismod semper.</p>
        <p>Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur.</p>
        <p>Etiam porta sem malesuada magna mollis euismod. Curabitur blandit tempus porttitor.</p>
      </div>
      <div class="tab-panel" id="tf-sent" hidden><h3 class="h5">Sent</h3><p>Nothing sent today.</p></div>
      <div class="tab-panel" id="tf-settings" hidden><h3 class="h5">Settings</h3><p>Signature, filters, vacation reply.</p></div>
    </div>
  </div>
</div>

An app tab bar

.tabs-fill-bottom moves the row to the bottom, like a phone app. Add .tabs-block for equal widths and .tabs-icons to put the icon above the name. The demo opens it in a full-size dialog; on a real app page use .tabs-fill-screen.

Home

The whole screen is the app. The tab bar stays at the bottom.

<button class="btn btn-brand" data-momo-dialog="tab-app"><i class="mi mi-layout-dashboard"></i> Open full screen</button>
<dialog class="dialog dialog-full p-0" id="tab-app" aria-label="App">
  <div class="tabs-fill tabs-fill-bottom">
    <div class="tabs tabs-block tabs-icons" data-momo-tabs aria-label="App sections">
      <button class="tab" aria-controls="ta-home" aria-selected="true"><i class="mi mi-house"></i> Home</button>
      <button class="tab" aria-controls="ta-search"><i class="mi mi-search"></i> Search</button>
      <button class="tab" aria-controls="ta-inbox"><i class="mi mi-inbox"></i> Inbox</button>
      <button class="tab" aria-controls="ta-me"><i class="mi mi-user"></i> Me</button>
    </div>
    <div class="tab-panels">
      <div class="tab-panel" id="ta-home"><div class="cluster justify-between items-center mb-4"><h2 class="h4 m-0">Home</h2><button class="btn btn-icon" data-momo-close aria-label="Close"><i class="mi mi-x"></i></button></div><p>The whole screen is the app. The tab bar stays at the bottom.</p></div>
      <div class="tab-panel" id="ta-search" hidden><h2 class="h4">Search</h2><input class="form-control" type="search" aria-label="Search"></div>
      <div class="tab-panel" id="ta-inbox" hidden><h2 class="h4">Inbox</h2><p>No new messages.</p></div>
      <div class="tab-panel" id="ta-me" hidden><h2 class="h4">Me</h2><p>Your profile.</p></div>
    </div>
  </div>
</dialog>

Fade between panels

Add .tabs-fade to the tab row and the panel you switch to fades in.

3 items: Momo Mug, Canvas Tote, Dot Notebook.

<div class="tabs tabs-line tabs-fade" data-momo-tabs aria-label="Order" id="tb-fade">
  <button class="tab" aria-controls="tf-1" aria-selected="true">Items</button>
  <button class="tab" aria-controls="tf-2">Shipping</button>
  <button class="tab" aria-controls="tf-3">Notes</button>
</div>
<div class="tab-panel" id="tf-1"><p class="mb-0">3 items: Momo Mug, Canvas Tote, Dot Notebook.</p></div>
<div class="tab-panel" id="tf-2" hidden><p class="mb-0">Standard shipping to Lisbon, 3 to 5 working days.</p></div>
<div class="tab-panel" id="tf-3" hidden><p class="mb-0">Gift wrap, with a handwritten card.</p></div>

Page tabs (links)

When each tab is its own page, use links and mark the current one with aria-current="page". No JavaScript needed.

<nav class="tabs tabs-line" aria-label="Project">
  <a class="tab" href="#" aria-current="page">Overview</a>
  <a class="tab" href="#">Files</a>
  <a class="tab" href="#">Activity</a>
</nav>

Disabled

<div class="tabs tabs-boxed" data-momo-tabs aria-label="Plans">
  <button class="tab" aria-selected="true">Basic</button>
  <button class="tab">Pro</button>
  <button class="tab" disabled>Team (soon)</button>
</div>

Keyboard

KeyDoes
← → (↑ ↓ when vertical)Move to the next tab and show it
Home EndFirst or last tab
TabLeave the tab row, go into the panel

With data-momo-tabs="manual" the arrows only move focus, and Enter or Space shows the tab (good when a panel is slow to load).

JavaScript

row.addEventListener('momo:tab', (e) => {
  console.log(e.detail.index, e.detail.tab, e.detail.panel);
});
Momo.tabs.select(row, 2); // show the third tab

Variables

VariableDefault
--tab-active-bg / --tab-active-colorInk / paper
--tab-height2.5rem

Start

OverviewStart Getting startedStart CustomizeStart

Guides

AccessibilityGuides BreakpointsGuides ChangelogGuides Customize componentsGuides JavaScriptGuides MotionGuides OptimizeGuides PhonesGuides RebootGuides Right-to-left (RTL)Guides Stacking orderGuides Using Momo with AIGuides

Foundations

ColorsFoundations TypographyFoundations ProseFoundations Images & figuresFoundations CodeFoundations Lines & shadowsFoundations Dark modeFoundations

Forms

Checkbox & switchForms ComboboxForms Date pickerForms Date rangeForms Fields & labelsForms File uploadForms Floating labelsForms Number stepperForms PasswordForms PIN codeForms RatingForms SelectForms SliderForms Tag inputForms Time pickerForms ValidationForms

Components

AccordionComponents Alert & bannerComponents AvatarComponents BadgeComponents BreadcrumbComponents ButtonComponents Button groupComponents CalendarComponents CardComponents CarouselComponents ChartsComponents ChipsComponents CollapseComponents Command paletteComponents CommentsComponents Confirm dialogsComponents Cookie bannerComponents Data tableComponents Description listComponents Dialog & toastComponents DividerComponents DrawerComponents Dropdown menuComponents Empty stateComponents File managerComponents Filter & sortComponents Gallery & lightboxComponents Inbox & chatComponents Infinite scrollComponents KanbanComponents Keyboard shortcutsComponents List groupComponents MarqueeComponents Media objectComponents Nav overflowComponents Notification centerComponents PaginationComponents ProgressComponents Pull to refreshComponents SkeletonComponents SortableComponents SpinnerComponents Split viewComponents Stat cardComponents Steps & wizardComponents Swipe actionsComponents TableComponents TabsComponents TimelineComponents TogglerComponents Tooltip & popoverComponents TourComponents Tree viewComponents VideoComponents WhiteboardComponents

Layout

Announcement barLayout App shellLayout Back to topLayout Container & sectionLayout ExamplesLayout FooterLayout HeroLayout JumbotronLayout Mega menuLayout NavbarLayout Site sidebarLayout

Sections

Bento gridSections Blog cardsSections Call to actionSections Contact & newsletterSections FAQSections FeaturesSections Logo cloudSections PricingSections TeamSections TestimonialsSections

Utilities

OverviewUtilities State variantsUtilities Display & flexUtilities Grid & gapUtilities SpacingUtilities SizingUtilities TextUtilities Links & color strengthUtilities Position & overflowUtilities BackgroundsUtilities Borders & effectsUtilities Transforms & filtersUtilities InteractionsUtilities

Helpers

Fixed, sticky & frostedHelpers Hover & focusHelpers Hover revealHelpers Icon linkHelpers PrintHelpers Relative timeHelpers Screen reader textHelpers Scroll inHelpers ScrollspyHelpers Share buttonHelpers Skip linkHelpers StacksHelpers Stretched linkHelpers Theme toggleHelpers Truncated textHelpers

Page patterns

404 pagePage patterns Coming soonPage patterns Login & registerPage patterns SettingsPage patterns ProfilePage patterns CRM contactsPage patterns ProjectsPage patterns File manager pagePage patterns Billing & plansPage patterns Help centerPage patterns Mobile app screensPage patterns
↑ ↓ moveEnter openEsc close