Tour

Shows new people around a screen, one step at a time.

import { Tour } from '@halo-ds/react';

When to use it

A tour points at one part of the screen at a time, with a short title, a line of help and Back, Next and Skip. The rest of the page is dimmed so people know where to look. Use it once, for people who are new, and let them skip it.

Do

  • Keep it to five steps or fewer.
  • Point at one thing per step and say what it does.
  • Let people skip, and never show it again once it is done or skipped.
  • Offer a way to replay it, like Take the tour under Help.

Don't

  • Show a tour every time someone signs in.
  • Explain what the screen already makes obvious.
  • Start a tour while people are in the middle of a task.
  • Put forms, long text or several links in a step.

Tour, Popover or Tooltip?

They look alike. A tour is the only one that opens on its own, moves between places and dims the page.

  • Tour: Opens on its own for new people. Steps through several places, dims the rest, and has Back, Next and Skip.
  • Popover: Opens when people click something. One panel of content or a short form, next to what they clicked.
  • Tooltip: A short label that shows on hover or focus. No buttons, and it never takes focus.

Props

Tour props

PropTypeWhat it does
steps (required)TourStep[]
open`boolean \undefined`
defaultOpen`boolean \undefined`
onOpenChange`((open: boolean) => void) \undefined`Called with false on Skip, Done and Escape.
step`number \undefined`The current step, from 0. Leave it out and the tour keeps its own, starting from the first step each time it opens.
onStepChange`((step: number) => void) \undefined`
onFinish`(() => void) \undefined`Called on Done. Save it so the tour does not show again.
onSkip`((step: number) => void) \undefined`Called on Skip or Escape, with the step people left on.
spotlight`boolean \undefined`Dims the rest of the page and leaves a hole around the target. Figma: Spotlight.
progress`"dots" \"count" \undefined`"2 of 5", or dots. Figma: Progress.
labels`Partial<TourLabels> \undefined`Button and counter text, for other languages.
className`string \undefined`
classNames`Partial<Record<TourPart, string>> \undefined`Extra class names for the parts inside the component, by part name, like { header: 'my-header' }.
styles`Partial<Record<TourPart, CSSProperties>> \undefined`Inline styles for the parts inside the component, by part name, like { footer: { gap: 4 } }.

It also takes the usual HTML attributes for its element.

Examples

Overview

import { useState } from 'react';
import { Button, Input, Tour } from '@halo-ds/react';
import { MagnifyingGlass, Plus } from '@phosphor-icons/react';

export default function Example() {
  const [open, setOpen] = useState(false);
  return (
    <div style={{ display: 'grid', gap: 16, justifyItems: 'center' }}>
      <div style={{ display: 'flex', gap: 12 }}>
        <Input id="tour-search" aria-label="Search" placeholder="Search" iconLeft={<MagnifyingGlass />} />
        <Button id="tour-new" iconLeft={<Plus />}>New</Button>
      </div>
      <Button variant="secondary" onClick={() => setOpen(true)}>Start the tour</Button>
      <Tour
        open={open}
        onOpenChange={setOpen}
        steps={[
          { title: 'Welcome', description: 'Here is a quick look around.' },
          { target: '#tour-search', title: 'Find anything', description: 'Search projects, people and files.' },
          { target: '#tour-new', title: 'Start something new', description: 'Create a project in one click.' },
        ]}
      />
    </div>
  );
}

Dots without a spotlight

Progress dots instead of a count, and no dimmed page around the target.

import { useState } from 'react';
import { Button, Tour } from '@halo-ds/react';

export default function Demo() {
  const [open, setOpen] = useState(false);
  return (
    <div className="demo-stack" style={{ justifyItems: 'center' }}>
      <Button id="tour-share" variant="secondary">Share</Button>
      <Button onClick={() => setOpen(true)}>Show me</Button>
      <Tour
        open={open}
        onOpenChange={setOpen}
        progress="dots"
        spotlight={false}
        steps={[
          { target: '#tour-share', title: 'Share your work', description: 'Invite people or copy a link.' },
          { title: 'That is it', description: 'You can start the tour again from Help.' },
        ]}
      />
    </div>
  );
}

More: https://halodesignsystem.dev/components/tour