Skip to content

Tour

Shows a short guide that points at parts of the page, one step at a time.

tour-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Usage

workspace.tsx

Composition

  • Tour

    Owns the open state and the step. Renders the popover for you.

    • TourTargetRepeats

      Wrap the element each step points at. The id matches the step id.

useTour Returns isOpen, step, count, start, stop, next, and previous for a button inside the tour.

Without spotlight

Set spotlight to false to keep the page usable. Also install Button and Checkbox.

Maya Chen
Due Thursday
Draft
tour-no-spotlight-demo.tsx

Controlled step

Also install Button and Stepper.

  1. One inbox
  2. Save a view
  3. A daily digest
Inbox · 4 unread
tour-controlled-demo.tsx

Start on first visit

Start the tour in an effect and save completion in onComplete. Also install Button.

Today · 3 notes, 2 tasks

First visit.

tour-first-visit-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria Popover (opens in a new tab).

Tour

Owns the open state and the step. Renders one non-modal popover and one spotlight.

steps: readonly TourStep[]Required
Sets the guide. Each step needs an `id` that matches a `TourTarget`, a title, and a description.
isOpen: boolean
Controls the tour.
defaultOpen: boolean = false
Opens the tour at first, at `defaultStep`.
onOpenChange: (isOpen: boolean) => void
Receives requests to open or close the tour.
step: number
Sets the current step, counted from zero.
defaultStep: number = 0
Sets the step that opens first.
onStepChange: (step: number) => void
Receives each step change from Next, Back, or `start`. A step without a mounted target is skipped in the direction of travel.
onComplete: () => void
Runs when Done is pressed on the last reachable step. The consumer saves progress here.
onSkip: () => void
Runs on Skip tour and on Escape.
spotlight: boolean = true
Dims the page except for the target and blocks clicks outside it. Set it to `false` to keep the page usable.

TourTarget

Wraps the element that a step points at. Its first element child is the target. The id matches the step id.

id: stringRequired
Matches the `id` of the step that points here.