@tour-kit/coreHooks
useTour
useTour hook: control tour state with start, next, prev, skip, and complete actions plus step tracking in React
domidex01Published
The primary hook for controlling tour state and actions.
Usage
import { useTour } from '@tour-kit/core';
function MyComponent() {
const {
isActive,
currentStep,
currentStepIndex,
totalSteps,
start,
next,
prev,
skip,
complete,
} = useTour('my-tour');
return (
<button onClick={() => start()}>
{isActive ? 'Tour Running' : 'Start Tour'}
</button>
);
}Return Value
Prop
Type
Starting at a Specific Step
const { start } = useTour('my-tour');
// Start at step index 2
start(2);Conditional Navigation
const { next, currentStep } = useTour('my-tour');
function handleNext() {
if (currentStep?.data?.requiresValidation) {
// Perform validation first
if (isValid) next();
} else {
next();
}
}Related
useStep— single-step state and visibility, whenuseTouris broader than you need.useTourContext— low-level context accessoruseTouris built on.<TourProvider>— must be an ancestor for this hook to work.<Tour>component — declarative wrapper most React apps use instead of calling this hook directly.- Imperative control guide — patterns for driving the tour from outside React events.
@tour-kit/coreAPI reference — full surface area of the core package.
Ship onboarding, not config.
npm i @tour-kit/core is MIT and free. The Pro packages work unlicensed too — a one-time $99 license removes the production watermark when you ship.
MIT-licensed — no signup, no credit card. Pay once, only when you ship.