Skip to content
v0.9.1
Layout

Site sidebar

The side menu of a docs site, a help center or a blog: groups of links next to the content, with an optional "On this page" list on the other side that follows along as you read. On a narrow screen the sidebar tucks away behind a Menu button and slides in from the side.

See it on a whole page

Sidebar

The sidebar sticks below the navbar while the content scrolls. Folding groups are <details>; the group holding the current page (aria-current="page") opens by itself.

Landing pages

Sections

The page content goes here. When this box is narrower than 832px, the sidebar becomes a panel behind the Menu button; try it on a phone or make the window narrow.

<div class="site-layout">
  <aside class="site-sidebar" aria-label="Docs">
    <div class="site-sidebar-head"><b>Docs</b><button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-close aria-label="Close"><i class="mi mi-x" aria-hidden="true"></i></button></div>
    <nav class="site-nav" aria-label="Docs pages">
      <div class="site-nav-group">
        <p class="site-nav-title">Get started</p>
        <ul>
          <li><a href="#"><i class="mi mi-rocket" aria-hidden="true"></i>Introduction</a></li>
          <li><a href="#"><i class="mi mi-download" aria-hidden="true"></i>Install</a></li>
          <li><a href="#"><i class="mi mi-palette" aria-hidden="true"></i>Customize <span class="badge badge-green">New</span></a></li>
        </ul>
      </div>
      <div class="site-nav-group">
        <p class="site-nav-title">Guides</p>
        <ul>
          <li>
            <details>
              <summary>Landing pages<i class="mi mi-chevron-right site-nav-caret rtl-flip" aria-hidden="true"></i></summary>
              <ul><li><a href="#">The hero</a></li><li><a href="#" aria-current="page">Sections</a></li><li><a href="#">The footer</a></li></ul>
            </details>
          </li>
          <li>
            <details>
              <summary>Docs sites<i class="mi mi-chevron-right site-nav-caret rtl-flip" aria-hidden="true"></i></summary>
              <ul><li><a href="#">The sidebar</a></li><li><a href="#">Search</a></li></ul>
            </details>
          </li>
          <li><a href="#">Dark mode</a></li>
        </ul>
      </div>
    </nav>
  </aside>
  <main class="site-main">
    <button class="btn btn-sm site-sidebar-toggle" type="button"><i class="mi mi-panel-left" aria-hidden="true"></i> Menu</button>
    <span class="eyebrow">Landing pages</span>
    <h3 class="mt-1">Sections</h3>
    <p class="text-muted">The page content goes here. When this box is narrower than 832px, the sidebar becomes a panel behind the Menu button; try it on a phone or make the window narrow.</p>
  </main>
</div>

On a phone

The same markup in a narrow box. Press Menu: the sidebar slides in from the side; a tap outside, Esc or picking a page closes it.

Introduction

Page content…

<div class="max-w-sm mx-auto box p-5">
  <div class="site-layout">
    <aside class="site-sidebar" aria-label="Docs (phone)">
      <div class="site-sidebar-head"><b>Docs</b><button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-close aria-label="Close"><i class="mi mi-x" aria-hidden="true"></i></button></div>
      <nav class="site-nav" aria-label="Docs pages (phone)">
        <div class="site-nav-group">
          <p class="site-nav-title">Get started</p>
          <ul>
            <li><a href="#" aria-current="page"><i class="mi mi-rocket" aria-hidden="true"></i>Introduction</a></li>
            <li><a href="#"><i class="mi mi-download" aria-hidden="true"></i>Install</a></li>
            <li><a href="#"><i class="mi mi-palette" aria-hidden="true"></i>Customize</a></li>
          </ul>
        </div>
      </nav>
    </aside>
    <main class="site-main">
      <button class="btn btn-sm site-sidebar-toggle" type="button"><i class="mi mi-panel-left" aria-hidden="true"></i> Menu</button>
      <h3 class="m-0">Introduction</h3>
      <p class="text-muted mb-0">Page content…</p>
    </main>
  </div>
</div>

On this page

Add a .site-toc after .site-main: a list of links to the headings on the page. Momo marks the section you are reading as you scroll (it gets .is-active and aria-current="location"). It shows when the layout is at least 1088px wide, so see it on the example page.

<aside class="site-toc" aria-label="On this page">
  <p class="site-toc-title">On this page</p>
  <ul>
    <li><a href="#install">Install</a></li>
    <li><a href="#usage">Usage</a>
      <ul><li><a href="#options">Options</a></li></ul>
    </li>
  </ul>
</aside>

The same follow-along marking works on any menu of #section links: give it data-momo-scrollspy.

The whole layout

<div class="site-layout container container-xl">
  <aside class="site-sidebar" aria-label="Docs">
    <div class="site-sidebar-head">…title and a data-momo-close button…</div>
    <nav class="site-nav">
      <div class="site-nav-group">
        <p class="site-nav-title">Get started</p>
        <ul><li><a href="…" aria-current="page">Install</a></li></ul>
      </div>
    </nav>
  </aside>
  <main class="site-main">
    <button class="btn btn-sm site-sidebar-toggle" type="button">Menu</button>
    …
  </main>
  <aside class="site-toc" aria-label="On this page">…</aside>
</div>

Classes

ClassDoes
.site-layoutSidebar, content and "On this page" side by side. It measures its own width: the sidebar shows from 832px, the list from 1088px.
.site-sidebarThe sidebar, 240px (--site-sidebar-w), sticky below a sticky navbar
.site-sidebar-toggleThe button that opens it when narrow (hidden when wide)
.site-sidebar-headTitle and close button, shown only in the narrow panel
.site-nav / -group / -title / -caretThe menu: groups with a small heading, links with icons and badges, <details> for folding
.site-mainThe content
.site-toc / .site-toc-title"On this page", 208px (--site-toc-w), follows along as you read
data-momo-scrollspyFollow-along marking for any menu of #section links

Without JavaScript a narrow sidebar sits above the content instead of hiding.

Accessibility

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