intro.js-react is a lightweight and actively maintained React wrapper for the Intro.js library, designed to simplify the creation of step-by-step product tours and hints within React applications. Currently at version 1.0.0, this package provides two primary components: `Steps` for guided tours and `Hints` for contextual popovers. It abstracts away direct Intro.js imperative API calls, allowing developers to manage tours declaratively using React props for configuration, steps, and lifecycle callbacks. Key differentiators include its adherence to React's component model, handling Intro.js instance management, and providing a more idiomatic React experience compared to integrating Intro.js directly. While it requires `intro.js` and `react` as peer dependencies, it handles the synchronization between React state and the underlying Intro.js instance, offering callbacks for various tour events like `onStart`, `onChange`, and `onComplete`. The package also supports Intro.js options directly through a dedicated `options` prop.
npm install intro.js-reactVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to integrate `intro.js-react` to create a guided product tour using the `Steps` component, including state management for enabling/disabling the tour and defining tour steps with CSS selectors.
Run `npm install intro.js react` or `yarn add intro.js react`.
Add `import 'intro.js/introjs.css';` to your application's entry point or a relevant component file.
Adjust your step indexing to start from 0 when working with `intro.js-react` components and callbacks.
Always provide an `onExit` function to the `Steps` component that sets `enabled` to `false` and resets `initialStep` if desired.
Ensure `intro.js` is installed and add `import 'intro.js/introjs.css';` to your project.
Install the peer dependencies: `npm install intro.js react` or `yarn add intro.js react`.
Define and pass an `onExit` function to the `Steps` component, typically to set `enabled` to `false`.