Search
Installation
$ pnpm dlx shadcn@latest add @synccn/tourFirst 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 }]
PropTypeDescription
- stepsrequired
TourStep[]Steps in order.
- openrequired
booleanWhether the tour is running.
- onOpenChangerequired
(open: boolean) => voidCalled when it's skipped or finished.
- onFinish
() => voidCalled after the last step.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for X
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
More overlays
DialogModal with focus trap, scroll lock and Escape to close.SheetPanel that slides in from the left, right or bottom.Dropdown MenuActions, checkboxes, labels and shortcuts with arrow-key navigation.Context MenuRight-click menu that also opens on long-press.PopoverFloating panel anchored to a trigger.TooltipLabel on hover and focus, on any side.