Moey Icons
No results. Try “dialog”, “dark” or “grid”.
Moey extras

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's done.

Revenue$4,210
Orders38
Returns2

Keys: → next, ← back, Esc to end.

<input class="form-control" type="search" placeholder="Search"
  data-moey-tour="welcome" data-moey-tour-order="1"
  data-moey-tour-title="Find anything"
  data-moey-tour-text="Search orders, customers and products from here.">

<button class="btn btn-default"
  data-moey-tour="welcome" data-moey-tour-order="2"
  data-moey-tour-title="Create an order"
  data-moey-tour-text="Phone orders and walk-ins go here.">New order</button>

<button class="btn" data-moey-tour-start="welcome">Start the tour</button>

Write a tour, step by step

  1. Mark the parts to show with data-moey-tour="welcome" (one name per tour) and give each a data-moey-tour-title and a short data-moey-tour-text.
  2. Order them with data-moey-tour-order="1", "2"… (else they follow the page).
  3. Start it from a button — data-moey-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 finished or skipped through. start({ force: true }) runs it again — from a Help menu, say.

const welcome = Moey.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: a card in the middle
], { once: 'welcome-v1' });

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

document.addEventListener('moey:tour-end', (e) => {
  if (e.detail.completed) track('tour finished');
});

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. Try it:

Tap "Start the tour"

Accessible

  • The card is a labelled dialog: screen readers hear the title, the text and "2 of 4"; the focus moves into it and Tab stays there.
  • → / ← step through, Esc ends it, and the focus goes back where it was.
  • Each part scrolls into view before it's shown; with reduced motion nothing slides.

Reference

Attribute / APIWhat it does
data-moey-tour="name"This part is a step of the tour "name"
data-moey-tour-title · -text · -orderThe card's title, text, and the step's place
data-moey-tour-start="name" (+ data-moey-tour-once)A button that starts it
Moey.tour(steps, { once, doneLabel })Steps: { target, title, text | html } → { start({ force, at }), next(), back(), end(), reset() }
Events (on document)moey:tour-step { index, step } · moey:tour-end { completed }