Skip to content
shadcn.io
shadcn.io is not affiliated with official shadcn/ui

Shadcn Tour for React and Tailwind

Displays a guided tour of the application.

Acme UI

Install

Add the component with the CLI, then import it.

Usage

Compose steps, then call start() from a trigger.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/tour.json

Anatomy

Tour
├── TourTrigger
├── TourActionTrigger
├── TourOverlay
└── TourContent
    ├── TourSpotlight
    ├── TourHeader
    │   ├── TourProgressText
    │   ├── TourTitle
    │   └── TourDescription
    ├── TourBody
    ├── TourFooter
    │   ├── TourActions
    │   ├── TourPreviousStep
    │   └── TourNextStep
    └── TourClose

Usage

import { 
  Tour, 
  TourTrigger, 
  TourContent, 
  TourHeader,
  TourProgressText,
  TourTitle,
  TourDescription,
  TourFooter,
  TourNextStep,
  TourPreviousStep,
} from "@/components/ui/tour";
<Tour steps={steps}>
  <TourTrigger>Open Tour</TourTrigger>
  <TourContent>
    <TourHeader>
      <TourProgressText />
      <TourTitle />
      <TourDescription />
    </TourHeader>
  </TourContent>
  <TourFooter>
    <TourNextStep />
    <TourPreviousStep />
  </TourFooter>
</Tour>

Examples

Step Types

Demonstrate all three step types in a single tour: dialog for welcome/completion, tooltip anchored to elements, and floating for fixed-position content.

Progress

Display a visual progress indicator at the bottom of the tour content showing how far along the user is.

Skip

Allow users to skip the entire tour at any step by adding a skip action.

Keyboard Navigation

Enable arrow key navigation between tour steps using the keyboardNavigation prop.

Events

Listen to tour lifecycle events like onStepChange and onStatusChange to track user progress.

Wait for Click

Use the effect function with waitForEvent to wait for user interaction before proceeding to the next step.

Wait for Input

Create form tutorials that wait for users to enter valid input before advancing.

Wait for Element

Wait for dynamically rendered elements to appear in the DOM before showing a step.

Async

Load data asynchronously and update step content before displaying it using the effect function with show() and update().

Custom spacing

Use [--space:--spacing("value")] on TourContent to adjust internal spacing.

Default spacing is --spacing(4).

You can use breakpoint utilities to change the internal spacing at different screen sizes.

  md:[--space:--spacing(6)] lg:[--space:--spacing(8)]

API Reference

Tour

PropTypeDefault
stepsTourStepDetails[][]
lazyMountbooleantrue
unmountOnExitbooleantrue
keyboardNavigationboolean-
onStepChange(details: { stepId: string | null }) => void-
onStatusChange(details: { status: string }) => void-
immediateboolean-
presentboolean-
onExitComplete() => void-

TourTrigger

PropTypeDefault
classNamestring-

TourContent

PropTypeDefault
showCloseButtonbooleantrue
classNamestring-
asChildboolean-
AttributeDefault
--space--spacing(4)

TourHeader

PropTypeDefault
classNamestring-

TourTitle

PropTypeDefault
classNamestring-

TourDescription

PropTypeDefault
classNamestring-

TourProgressText

PropTypeDefault
classNamestring-

TourFooter

PropTypeDefault
classNamestring-

TourActions

PropTypeDefault
classNamestring-

TourPreviousStep

PropTypeDefault
asChildboolean-

TourNextStep

PropTypeDefault
asChildboolean-

TourClose

PropTypeDefault
asChildboolean-

useTourContext

ReturnType
tourUseTourReturn
handleStart() => void

For a complete list of props, see the Ark UI documentation.