First run tour (Pro)
ProIncluded in $99Spotlight coachmarks that point at the real interface, with a cut out that glides from target to target and a tour that resumes where it was left.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { FirstRunTour } from "@/components/ui/chatcn/pro/first-run-tour"
<FirstRunTour
steps={[
{ target: "composer", title: "Ask anything here", body: "Enter sends." },
{ target: "model", title: "Pick the model" },
{ title: "That is everything" },
]}
defaultOpen={isFirstVisit}
storageKey="tour:v1"
>
<App />
</FirstRunTour>Wrap the app and mark targets with data-tour. The app dims except for a cut out around the current target, and the cut out glides to the next one rather than jumping, so the eye follows. The card sits below the target when it fits, otherwise above, and a step with no target sits in the middle. Arrow keys move through it, Escape leaves, and with storageKey a tour left halfway resumes at the same step next time. While it is open the app behind is inert, so nothing gets clicked by accident.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
children | ReactNode | The app, with data-tour targets |
steps | TourStep[] | { target?, title, body? } |
open, defaultOpen, onOpenChange | boolean | |
step, defaultStep, onStepChange | number | |
onFinish, onSkip | () => void, (step) => void | Done, or left at a step |
storageKey | string | null | Remember the step to resume |
labels | Partial<FirstRunTourLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Right, Left | Next, back (reversed right to left) |
| Escape | Leave the tour |
| Tab | Move between the card's buttons |
Accessibility
- The card is a modal dialog named by the step's title, focused on each step.
- The app behind is inert while the tour is open.
- The step count is text, beside a progress line.
Motion
The cut out and the card glide to the next target in 360 ms on the kit's ease out. Under reduced motion they move at once.