Skip to content
v0.9.1
Components

Dialog

A box over the page for a focused task. It is the native <dialog>: the keyboard stays inside it, Esc closes it, and focus goes back to the button that opened it. On phones it slides up as a bottom sheet.

Basic

Give a button data-momo-dialog="id". Buttons with data-momo-close close it. Clicking outside does not close it, so typed text is never lost.

Create project

Deploy your new project in one click.

<button class="btn btn-brand" type="button" data-momo-dialog="d-project"><i class="mi mi-plus"></i> Create project</button>
<dialog class="dialog" id="d-project" aria-labelledby="d-project-title">
  <div class="dialog-header">
    <h2 class="dialog-title" id="d-project-title">Create project</h2>
    <button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-close aria-label="Close"><i class="mi mi-x"></i></button>
  </div>
  <div class="dialog-body">
    <p class="text-muted">Deploy your new project in one click.</p>
    <div class="form-field">
      <label class="form-label" for="dp-name">Name</label>
      <input class="form-control" id="dp-name" placeholder="Name of your project" autofocus>
    </div>
    <div class="form-field">
      <label class="form-label" for="dp-fw">Framework</label>
      <select class="form-select" id="dp-fw"><option>Momo</option><option>Plain HTML</option></select>
    </div>
  </div>
  <div class="dialog-footer">
    <button class="btn btn-ghost" type="button" data-momo-close>Cancel</button>
    <button class="btn btn-brand" type="button" data-momo-close value="deploy">Deploy</button>
  </div>
</dialog>

Confirm

.dialog-alert is a short question with an icon tile. Add data-momo-close-outside when a click outside should cancel.

Delete this task?

"Design search page" and its 4 comments will be gone for good.

<button class="btn" type="button" data-momo-dialog="d-delete"><i class="mi mi-trash-2"></i> Delete task</button>
<dialog class="dialog dialog-alert" id="d-delete" aria-labelledby="d-delete-title" aria-describedby="d-delete-text" data-momo-close-outside>
  <div class="dialog-body">
    <span class="dialog-icon bg-red"><i class="mi mi-trash-2"></i></span>
    <div>
      <h2 class="dialog-title" id="d-delete-title">Delete this task?</h2>
      <p id="d-delete-text" class="text-muted">"Design search page" and its 4 comments will be gone for good.</p>
    </div>
  </div>
  <div class="dialog-footer dialog-footer-plain">
    <button class="btn btn-ghost" type="button" data-momo-close autofocus>Keep it</button>
    <button class="btn btn-red" type="button" data-momo-close value="delete">Delete</button>
  </div>
</dialog>

Drawer

.dialog-drawer slides in from the right as a side panel (.dialog-drawer-start from the left). Good for filters and details. The Drawer page has every side, sizes and a site menu.

Filters

Status
<button class="btn" type="button" data-momo-dialog="d-filters"><i class="mi mi-sliders-horizontal"></i> Filters</button>
<dialog class="dialog dialog-drawer" id="d-filters" aria-labelledby="d-filters-title">
  <div class="dialog-header">
    <h2 class="dialog-title" id="d-filters-title">Filters</h2>
    <button class="btn btn-icon btn-sm btn-ghost" type="button" data-momo-close aria-label="Close"><i class="mi mi-x"></i></button>
  </div>
  <div class="dialog-body">
    <fieldset class="check-group">
      <legend class="form-label">Status</legend>
      <label class="check"><input type="checkbox" checked> Paid</label>
      <label class="check"><input type="checkbox" checked> Pending</label>
      <label class="check"><input type="checkbox"> Unpaid</label>
    </fieldset>
    <div class="form-field">
      <label class="form-label" for="df-method">Method</label>
      <select class="form-select" id="df-method"><option>Any</option><option>Credit card</option><option>PayPal</option></select>
    </div>
  </div>
  <div class="dialog-footer">
    <button class="btn btn-ghost" type="button" data-momo-close>Reset</button>
    <button class="btn btn-brand" type="button" data-momo-close>Show results</button>
  </div>
</dialog>

Sizes

.dialog-sm (24rem), default (32rem), .dialog-lg (48rem), .dialog-full. Long content scrolls inside .dialog-body while the header and footer stay put. .dialog-center keeps a phone dialog in the middle instead of a sheet.

Toast

A short message in the corner that goes away by itself after 5 seconds (it waits while you hover or focus it). Call Momo.toast(), or give a button data-momo-toast.

<button class="btn" type="button" data-momo-toast="Settings saved" data-momo-toast-text="Your changes are live." data-momo-toast-color="green">Save</button>
<button class="btn" type="button" data-momo-toast="Upload failed" data-momo-toast-text="The file is over 10 MB." data-momo-toast-color="red">Upload</button>
<button class="btn" type="button" data-momo-toast="New message" data-momo-toast-text="Sarah tagged you in Q3 roadmap." data-momo-toast-icon="message-square">Message</button>
Momo.toast({
  title: 'Task deleted',
  text: 'Design search page',
  color: 'yellow',
  icon: 'trash-2',
  timeout: 8000,                       // 0 = stays until closed
  action: { label: 'Undo', onClick: () => restore() },
});

Toasts sit above dialogs, and screen readers announce them (errors right away, others politely).

Several at once

They pile up in the corner: the newest in front, two more peeking out behind it, each a little smaller. Hover the pile (or Tab into it) and it fans out into a list, and every toast waits while you read. Up to 5 are kept; a sixth closes the oldest. Swipe one sideways to dismiss it.

<button class="btn btn-brand" type="button" id="toast-many"><i class="mi mi-layers"></i> Show four</button>
<button class="btn" type="button" data-momo-toast="Copied" data-momo-toast-text="The link is on your clipboard." data-momo-toast-icon="copy">One more</button>
<script>
  document.getElementById('toast-many').addEventListener('click', function () {
    var list = [
      { title: 'Order #10421 paid', text: '$129.00 from Max Ruiz', color: 'green', icon: 'credit-card' },
      { title: 'New comment', text: 'Ana: "Can this ship by Friday?"', icon: 'message-circle' },
      { title: 'Low stock', text: 'Momo Mug: 4 left', color: 'orange', icon: 'package' },
      { title: 'Backup finished', text: 'All 2,318 files are safe.', color: 'cyan', icon: 'cloud' },
    ];
    list.forEach(function (o, i) { setTimeout(function () { Momo.toast(o); }, i * 350); });
  });
</script>

Where they appear

Bottom right by default. Set it once for the whole page on <body>: top-start, top-center, top-end, bottom-start, bottom-center or bottom-end. Start and end follow the page's direction. On phones they take the full width.

<body data-momo-toast-position="top-center">

JavaScript

Momo.dialog.open('d-project');
document.getElementById('d-project').addEventListener('close', (e) => {
  console.log(e.target.returnValue); // "deploy" when that button closed it
});

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