Skip to content

toolmark-monorepo / @toolmark/tour/react / useTour

Function: useTour() ​

useTour(tour): TourState | null

Defined in: packages/tour/src/react/index.ts:23

Subscribes to a tour's state for a custom (headless) UI. Re-renders on every state change; null while there is no tour and during server rendering.

Parameters ​

tour ​

Tour | null

The tour from startTour, or null.

Returns ​

TourState | null

The current TourState, or null.

Example ​

tsx
const state = useTour(tour)
if (state?.status === 'running') return <Callout anchor={state.anchor} step={state.steps[state.index]} />