NextStep - Lightweight Next.js Onboarding Library Logo

API Reference for React

Detailed information about NextStepjs components, props, and hooks for React applications.

NextStepReact Props

The NextStepReact component is the main component that wraps your application and provides the onboarding functionality.

PropTypeDescription
childrenReact.ReactNodeYour website or application content
stepsTour[]Array of Tour objects defining each step of the onboarding
navigationAdapterNavigationAdapterOptional. Router adapter for navigation (defaults to window adapter)
showNextStepbooleanControls visibility of the onboarding overlay
shadowRgbstringRGB values for the shadow color surrounding the target area
shadowOpacitystringOpacity value for the shadow surrounding the target area
cardComponentReact.ComponentTypeCustom card component to replace the default one
cardTransitionTransitionFramer Motion transition object for step transitions
onStart(tourName?: string | null) => voidCallback function triggered when the tour starts
onStepChange(step: number, tourName?: string | null) => voidCallback function triggered when the step changes
onComplete(tourName?: string | null) => voidCallback function triggered when the tour completes
onSkip(step: number, tourName?: string | null) => voidCallback function triggered when the user skips the tour
clickThroughOverlaybooleanIf true, overlay background is clickable, default is false
disableConsoleLogsbooleanOptional. If true, console logs are disabled, default is false
scrollToTopbooleanOptional. If true, the page will scroll to the top when the tour starts, default is true
noInViewScrollbooleanOptional. If true, the page will not scroll to the target element when it is in view, default is false

Step Object

Each step in a tour is defined by a Step object with the following properties:

PropertyTypeDescription
iconReact.ReactNode | string | nullAn icon or element to display alongside the step title
titlestringThe title of your step
contentReact.ReactNodeThe main content or body of the step
selectorstringOptional. A string used to target an `id` that this step refers to
side"top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "left-top" | "left-bottom" | "right-top" | "right-bottom"Optional. Determines where the tooltip should appear relative to the selector
showControlsbooleanOptional. Determines whether control buttons should be shown if using the default card
showSkipbooleanOptional. Determines whether skip button should be shown if using the default card
blockKeyboardControlbooleanOptional. Determines whether keyboard control should be blocked
pointerPaddingnumberOptional. The padding around the pointer highlighting the target element
pointerRadiusnumberOptional. The border-radius of the pointer highlighting the target element
nextRoutestringOptional. The route to navigate to when moving to the next step
prevRoutestringOptional. The route to navigate to when moving to the previous step
viewportIDstringOptional. The id of the viewport to target. Used with NextStepViewport component.

Tour Object

NextStepjs supports multiple tours, each defined by a Tour object:

PropertyTypeDescription
tourstringThe unique identifier for this tour
stepsStep[]Array of Step objects defining each step of this tour

useNextStep Hook

The useNextStep hook provides programmatic control over the tour. You can use it to start, stop, skip, or navigate through steps.

useNextStep Hook Return Values
PropertyTypeDescription
startNextStep(tourName: string) => voidStarts the specified tour
closeNextStep() => voidStops the current tour
currentTourstring | nullThe name of the current tour
currentStepnumberThe current step index
setCurrentStep(step: number, delay?: number) => voidSets the current step index with optional delay
isNextStepVisiblebooleanWhether the tour overlay is currently visible