Skip to content
synccn

Tour

New

Step-by-step product tour that spotlights parts of the page.

Installation

$ pnpm dlx shadcn@latest add @synccn/tour

First time in this project? Connect synccn with one command.

Usage

import { Tour } from "@/components/ui/tour";<Tour open={open} onOpenChange={setOpen} steps={steps} />

API reference

Generated from the component's TypeScript types, so it always matches the code.

Tour

Product tour: dims the page, cuts a spotlight around each target element and shows a step card beside it. Steps target elements by CSS selector. steps: [{ target: "#id", title, body }]

  • stepsrequired
    TourStep[]

    Steps in order.

  • openrequired
    boolean

    Whether the tour is running.

  • onOpenChangerequired
    (open: boolean) => void

    Called when it's skipped or finished.

  • onFinish
    () => void

    Called after the last step.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

  • lib/utilscn (merges class names)
  • lib/hooksuseIsClient (renders portals only in the browser)

npm packages

Keyboard

  • →Next step
  • ←Previous step
  • EscEnd the tour

Accessibility

  • Each step is a modal dialog. Steps whose target isn't on the page are shown centred.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: dialog
  • ARIA attributes: aria-label, aria-modal
  • Keys handled: ArrowLeft, ArrowRight, Escape