useTourRegistryContext
Low-level hooks for reading the registered tour list inside MultiTourKitProvider. Use useTours for ergonomic access.
Low-level access to the tour registry exposed by MultiTourKitProvider. Most consumers should use useTours — useTourRegistryContext is the escape hatch for custom registry integrations (declarative <Tour> mounting, tour deduplication, debug panels).
Usage
import { useTourRegistryContext } from '@tour-kit/react';
function RegistrySize() {
const { tours } = useTourRegistryContext();
return <span>Registered tours: {tours.length}</span>;
}useTourRegistryContext throws if no <MultiTourKitProvider> is mounted above. Use useTourRegistryContextOptional if rendering inside a tree that may or may not have a provider.
Return Value
| Field | Type | Description |
|---|---|---|
tours | Tour[] | All currently registered tours. |
registerTour | (tour: Tour) => void | Add a tour to the registry. Called internally by <Tour> on mount. |
unregisterTour | (tourId: string) => void | Remove a tour from the registry. Called internally by <Tour> on unmount. |
useTourRegistryContextOptional
Same as useTourRegistryContext but returns null instead of throwing when no provider is present. Useful for components that may render outside a MultiTourKitProvider.
import { useTourRegistryContextOptional } from '@tour-kit/react';
function ContextAwareLauncher() {
const ctx = useTourRegistryContextOptional();
if (!ctx) return <button>Help</button>; // standalone mode
return <TourSelector tours={ctx.tours} />;
}Returns TourRegistryContextValue | null.
For tour listing, completion checks, and active-tour state, prefer useTours — it wraps useTourRegistryContext and exposes a flatter API (tours, activeTourId, isTourCompleted, etc.).
Related
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.