Skip to content
v0.9.1
Components

Tour

Show new people around: a spotlight on one part of the page and a short card explaining it, step by step, with Back, Next and Skip. Write it right in your HTML, or start it from code; let it run once and remember it is done.

In HTML

Mark the parts to show, then start the tour from a button. Keys: → next, ← back, Esc to end.

Revenue$4,210
Orders38
Returns2
<div class="border rounded bg-surface p-4 stack gap-4" id="tour-demo">
  <div class="cluster gap-3 items-center justify-between">
    <input class="form-control w-64" type="search" placeholder="Search" aria-label="Search"
      data-momo-tour="welcome" data-momo-tour-order="1"
      data-momo-tour-title="Find anything"
      data-momo-tour-text="Search orders, customers and products from here.">
    <button class="btn btn-brand" type="button"
      data-momo-tour="welcome" data-momo-tour-order="2"
      data-momo-tour-title="Create an order"
      data-momo-tour-text="Phone orders and walk-ins go here."><i class="mi mi-plus"></i> New order</button>
  </div>
  <div class="grid sm:grid-cols-3 gap-3" data-momo-tour="welcome" data-momo-tour-order="3" data-momo-tour-title="Today at a glance" data-momo-tour-text="Revenue, orders and returns, updated as they happen.">
    <div class="stat stat-sm"><span class="stat-label">Revenue</span><span class="stat-value">$4,210</span></div>
    <div class="stat stat-sm"><span class="stat-label">Orders</span><span class="stat-value">38</span></div>
    <div class="stat stat-sm"><span class="stat-label">Returns</span><span class="stat-value">2</span></div>
  </div>
  <div class="cluster justify-end">
    <button class="btn btn-ghost btn-sm" type="button" data-momo-tour="welcome" data-momo-tour-order="4" data-momo-tour-title="Stuck?" data-momo-tour-text="Help is always one tap away."><i class="mi mi-circle-help"></i> Help</button>
  </div>
</div>
<button class="btn mt-3" type="button" data-momo-tour-start="welcome"><i class="mi mi-sparkles"></i> Start the tour</button>

Write a tour, step by step

  1. Mark the parts to show with data-momo-tour="welcome" (one name per tour) and give each a data-momo-tour-title and a short data-momo-tour-text.
  2. Order them with data-momo-tour-order="1", "2" ... (else they follow the page).
  3. Start it from a button with data-momo-tour-start="welcome", or from code on someone's first visit (below).
  4. Keep it short. Three to five steps about things people need on day one, a sentence or two each. Parts that are hidden on this screen (a sidebar on a phone) are skipped by themselves.

From code, once per person

Give the steps as a list and once a name: the tour starts on the first visit and is remembered as done (in the browser) when it is finished or skipped. start({ force: true }) runs it again, from a Help menu, say. A step without a target is a card in the middle of the screen.

const welcome = Momo.tour([
  { target: '#search', title: 'Find anything', text: 'Search orders, customers and products.' },
  { target: '#new-order', title: 'Create an order', text: 'Phone orders and walk-ins go here.' },
  { title: "You're all set", text: 'Press ? any time to see the keyboard shortcuts.' },   // no target
], { once: 'welcome-v1' });

welcome.start();                                  // does nothing if it was done before
helpMenu.onclick = () => welcome.start({ force: true });

document.addEventListener('momo:tour-end', (e) => {
  if (e.detail.completed) track('tour finished');
});
<button class="btn" type="button" id="tour-code"><i class="mi mi-play"></i> Run the coded tour</button>
<script>
  document.getElementById('tour-code').addEventListener('click', function () {
    Momo.tour([
      { target: '#tour-demo input', title: 'Find anything', text: 'Search orders, customers and products.' },
      { target: '#tour-demo .btn-brand', title: 'Create an order', text: 'Phone orders and walk-ins go here.' },
      { title: "You're all set", text: 'That is the whole tour. Have fun!' },
    ], { doneLabel: 'Got it' }).start({ force: true });
  });
</script>

On a phone

The card docks to the bottom of the screen (or the top, when the part is low), out of the way of the spotlight, and takes the full width.

Accessible

Reference

Attribute / APIWhat it does
data-momo-tour="name"This part is a step of the tour "name"
data-momo-tour-title, -text, -orderThe card's title, its text, and the step's place
data-momo-tour-start="name"A button that starts it (data-momo-tour-once="key": only the first time; data-momo-tour-done="Got it": the last button's label)
Momo.tour(steps, { once, doneLabel })Steps: { target, title, text | html }. Gives start({ force, at }), next(), back(), end(), reset()
Events (on document)momo:tour-step { index, step }, momo:tour-end { completed }

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