Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Pro (paid add-on)

Product tour

Pro

Tour walks people through your interface: each step highlights an element, dims the rest of the page and explains it in a card beside it, as an accessible modal dialog.

Part of Pro

This page documents part of @vjdesigns-pro/ui, the paid add-on package. Using it needs a Pro license and @vjdesigns/vjdesigns-ui 3.8.0 or later. Like the free package, it works in both modes, every brand, all 32 languages and right to left. Install it as described in Account forms.

Example

Each step highlights an element (a ref, a CSS selector, or a function that finds it), dims the rest of the page, and explains it in a card beside it with Back, Continue or Finish, and "Step 2 of 4". Leave out target for a centered step, such as a welcome. A target that isn't on the page falls back to centered too.

tsx
import { Tour } from "@vjdesigns-pro/ui";
import { Button } from "@vjdesigns/vjdesigns-ui";

const [open, setOpen] = useState(false);

<Button onClick={() => setOpen(true)}>Take the tour</Button>
<Tour
  open={open}
  onOpenChange={setOpen}
  onComplete={markTourSeen}
  steps={[
    { title: "Welcome to Courtside", content: <p>Take a quick look around.</p> },
    { target: "#search", title: "Search anything", content: <p>Find players, games, and teams.</p> },
    { target: newGameRef, title: "Schedule a game", placement: "bottom-end", content: <p>Players get notified.</p> },
  ]}
/>

Accessible by default

  • Each step is a modal dialog named by its title and described by its content. Focus moves to the title on every step, so screen readers read it.
  • Tab stays in the card, and the rest of the page is inert while the tour is open.
  • Escape or Close ends the tour, and focus returns to where it was.
  • The target scrolls into view (without animating under reduced motion), and the spotlight follows it through scrolling and resizing.
  • In Windows High Contrast mode, the target gets a system-color outline instead of the dimming.

Control and options

  • open and onOpenChange show and hide the tour; step and onStepChange control the current step.
  • onComplete runs only when Finish is pressed, so you can remember that someone finished the tour.
  • placement on a step sets where its card sits (for example "bottom-end").
  • spotlight={false} turns off the dimming, and labels overrides the button text and the progress format.

Props

Tour

A guided walkthrough of your interface: each step highlights an element and explains it in a card beside it, with Back, Next, and Finish.

Accessibility: each step is a modal dialog (role="dialog", aria-modal="true") named by its title and described by its content. Focus moves to the step's title when the tour opens and on every step, so screen readers read it; Tab stays inside the card; the rest of the page is inert while the tour is open (the highlight is visual only). Escape or the close button ends the tour, and focus returns to where it was. Progress ("Step 2 of 4") is text, never only dots or color.

Tour props
PropTypeDefault
stepsRequired

The stops, in order.

TourStep[]—
open

Controlled open state.

boolean—
defaultOpen

Initial open state when uncontrolled.

booleanfalse
onOpenChange

Called with false when the tour is closed (close button, Escape, or Finish).

(open: boolean) => void—
step

Controlled current step (0-based).

number—
defaultStep

Initial step when uncontrolled (0-based).

number0
onStepChange

Called with the new step index when the user goes Back or Next.

(step: number) => void—
onComplete

Called when the user presses Finish on the last step (before the tour closes).

() => void—
spotlight

Dim the page around the target.

booleantrue
spotlightPadding

Space between the target and the spotlight's edge, in px.

number8
labels

Text overrides for the buttons and progress.

TourLabels—
className

Additional class for the step card.

string—

TourStep

One stop on the tour.

TourStep props
PropTypeDefault
target

The element to highlight and point at. Leave it out (or let it resolve to nothing) for a step centered on the screen, such as a welcome.

TourTarget—
titleRequired

Heading of the step; the dialog's accessible name.

ReactNode—
content

What to know about the target; the dialog's accessible description.

ReactNode—
placement

Preferred side of the target for the card. Flips when there isn't room.

"top""top-start""top-end""bottom""bottom-start""bottom-end""left""left-start""left-end""right""right-start""right-end""bottom"

TourLabels

Text overrides. Every label defaults to the translated built-in text.

TourLabels props
PropTypeDefault
backstring"Back"
nextstring"Continue"
finishstring"Finish"
close

Accessible name of the close button.

string"Close"
step

Progress text, e.g. (step, total) => \${step} / ${total}\``.

(step: number, total: number) => string"Step 2 of 4"