9

API Reference

PreviousNext

Complete API reference for the Tour component.

TourProvider

The TourProvider component is the main container that provides tour functionality to your application.

Props

PropTypeDescription
toursTour[]Array of tours configuration.
childrenReact.ReactNodeContent to wrap with the tour context.

Tour

Configuration object for a tour.

PropertyTypeDescription
idstringUnique identifier for the tour.
stepsStep[]Array of steps in the tour.

Step

Each step in the tour has the following properties:

PropertyTypeDescription
idstringUnique identifier for the step. Used to find the target element by matching its data-tour-step-id attribute.
titleReact.ReactNodeTitle displayed in the tour card.
contentReact.ReactNodeContent displayed in the tour card.
side"top" | "bottom" | "left" | "right"Optional. The preferred side of the anchor to render against when open.
sideOffsetnumberOptional. The distance in pixels from the anchor.
align"start" | "center" | "end"Optional. The preferred alignment against the anchor.
alignOffsetnumberOptional. An offset in pixels from the "start" or "end" alignment options.
classNamestringOptional. Additional CSS classes to apply to the tour popover.
nextRoutestringOptional. Route to navigate to when the "Next" button is clicked.
previousRoutestringOptional. Route to navigate to when the "Previous" button is clicked.
nextLabelReact.ReactNodeOptional. Custom content for the "Next" button. Defaults to "Next" or "Finish" on the last step.
previousLabelReact.ReactNodeOptional. Custom content for the "Previous" button. Defaults to "Previous".

useTour

The useTour hook provides methods to control the tour's visibility.

Return Value

PropertyTypeDescription
start(tourId: string) => voidFunction to start a specific tour by its ID.
close() => voidFunction to close the current tour.