Skip to content
v0.9.1
Helpers

Theme toggle

Let people switch between light and dark. Momo follows the system setting by default; a toggle or a choice of "Light / Dark / System" overrides it and is remembered on every page.

Toggle

A button with data-momo-theme-toggle flips the mode. Put a moon and a sun in it: .theme-icon-light shows in light mode, .theme-icon-dark in dark. Add data-momo-theme-dark="dark-black" (or "dark-split") to switch to another dark instead.

<button class="btn btn-icon" type="button" data-momo-theme-toggle aria-label="Dark mode"><i class="mi mi-moon theme-icon-light" aria-hidden="true"></i><i class="mi mi-sun theme-icon-dark" aria-hidden="true"></i></button>
<button class="btn" type="button" data-momo-theme-toggle><i class="mi mi-moon theme-icon-light" aria-hidden="true"></i><i class="mi mi-sun theme-icon-dark" aria-hidden="true"></i> Switch mode</button>

Light, dark or system

Buttons with data-momo-theme="light", "dark", "dark-black", "dark-split" (see three darks) or "system"; the chosen one gets aria-pressed="true".

<div class="btn-row" role="group" aria-label="Color mode">
  <button class="btn btn-sm" type="button" data-momo-theme="light"><i class="mi mi-sun" aria-hidden="true"></i> Light</button>
  <button class="btn btn-sm" type="button" data-momo-theme="dark"><i class="mi mi-moon" aria-hidden="true"></i> Dark</button>
  <button class="btn btn-sm" type="button" data-momo-theme="system"><i class="mi mi-monitor" aria-hidden="true"></i> System</button>
</div>

No flash on load

Put this one line in the <head>, before the stylesheet, so a page opened in dark mode never flashes white first:

<script>try{var m=localStorage.getItem('momo-mode');if(m)document.documentElement.setAttribute('data-momo-mode',m)}catch(e){}</script>

Notes

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