Feedback

Tour

Step-by-step onboarding guide that spotlights specific elements with a popover and mask overlay.

Step 2 target element

Installation

npx benflux-ui add tour

Usage

import { Tour, type TourStep } from "@benflux-ui/react"

const buttonRef = useRef<HTMLButtonElement>(null)

const steps: TourStep[] = [
  {
    title: "Step 1",
    description: "Click this button to proceed.",
    target: () => buttonRef.current,
    placement: "bottom",  // "top" | "bottom" | "left" | "right" | "center"
  },
  {
    title: "Done",
    description: "You've completed the tour!",
  },
]

<Button ref={buttonRef}>Action</Button>
<Tour open={open} onClose={() => setOpen(false)} steps={steps} />

Props — Tour

PropTypeDefaultDescription
open*booleanControls visibility of the tour
onClose*() => voidCalled when the tour is dismissed
steps*TourStep[]Array of step definitions
currentnumber0Controlled current step index
onChange(current: number) => voidCalled when the step changes

Props — TourStep

PropTypeDefaultDescription
title*ReactNodeStep title
descriptionReactNodeStep body text
target() => Element | nullRef getter pointing to the element to highlight
placement"top" | "bottom" | "left" | "right" | "center""bottom"Popover placement relative to the target