# react-shepherd

Latest version **8.0.0** (published 2026-11-11) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install react-shepherd
pnpm add react-shepherd
yarn add react-shepherd
bun add react-shepherd
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; popular repo.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 8.0.0 |
| Published | 2026-11-11 |
| First published | 2018-04-02 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 45.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 13843 |
| Maintainers | rwwagner90, chuckcarpenter |

## Links

- npm: https://www.npmjs.com/package/react-shepherd
- Repository: https://github.com/shipshapecode/shepherd
- npm.io page: https://npm.io/package/react-shepherd

## Dependencies (1)

- [shepherd.js](https://npm.io/package/shepherd.js.md) 16.0.0

## Recent versions

- 8.0.0 (latest) — 2026-11-11
- 5.0.0-alpha.7 (alpha) — 2024-04-16
- 7.0.6 — 2026-08-24
- 7.0.5 — 2026-08-10
- 7.0.4 — 2026-03-11
- 7.0.3 — 2026-02-23
- 7.0.2 — 2026-02-19
- 7.0.1 — 2026-02-18
- 7.0.0 — 2026-02-08
- 6.1.9 — 2025-07-23
- 6.1.8 — 2025-02-20
- 6.1.7 — 2025-01-13
- 6.1.6 — 2024-11-19
- 6.1.4 — 2024-10-21
- 6.1.3 — 2024-10-10
- … 37 more at https://npm.io/package/react-shepherd/versions

## README

# react-shepherd

[![NPM](https://img.shields.io/npm/v/react-shepherd.svg)](https://www.npmjs.com/package/react-shepherd)

This is a React wrapper for the
[Shepherd](https://github.com/shipshapecode/shepherd) tour library. It's mainly
a wrapper around the Shepherd library that exposes the tour object and methods
to the context object that can be passed into props for dynamic interactivity.

## Install

Use this simple NPM command or whatever package manager is your favorite.

```bash
npm install --save react-shepherd
```

## Usage

### Via Provider/Context

```tsx
import { useEffect, useMemo } from 'react';
import { ShepherdJourneyProvider, useShepherd } from 'react-shepherd';
import 'shepherd.js/dist/css/shepherd.css';

const tourOptions = {
  defaultStepOptions: {
    cancelIcon: {
      enabled: true
    }
  },
  useModalOverlay: true,
  steps: [
    {
      title: 'Welcome',
      text: 'This is the only step.',
      buttons: [{ text: 'Done', action: 'complete' as const }]
    }
  ]
};

function Button() {
  const Shepherd = useShepherd();
  const tour = useMemo(() => new Shepherd.Tour(tourOptions), [Shepherd]);

  // Ends the tour if this component unmounts while it is open.
  useEffect(
    () => () => {
      if (tour.isActive()) tour.complete();
    },
    [tour]
  );

  return (
    <button className="button dark" onClick={tour.start}>
      Start Tour
    </button>
  );
}

export default function App() {
  return (
    <div>
      <ShepherdJourneyProvider>
        <Button />
      </ShepherdJourneyProvider>
    </div>
  );
}
```

### Starting a tour when a component mounts

Create the tour in an effect and end it in the cleanup. React StrictMode runs
effects twice, and a tour left open by the first run stays on screen next to the
second. The cleanup fires the tour's `complete` event.

```tsx
useEffect(() => {
  const tour = new Shepherd.Tour(tourOptions);
  tour.start();
  return () => {
    tour.complete();
  };
}, [Shepherd]);
```

## API

- `ShepherdJourneyProvider`: wrap your app in it.
- `useShepherd()`: takes no arguments and returns the `Shepherd` object. Pass
  [tour options](https://docs.shepherdjs.dev/api/tour/classes/tour/) to
  `new Shepherd.Tour()`.

Older versions exported `ShepherdTour` and `ShepherdTourContext`. They no longer
exist.

## License

`react-shepherd` is licensed under **AGPL-3.0** (for open source and
non-commercial use) with a **Commercial License** available for commercial use.

- **Free** for open source and non-commercial projects under AGPL-3.0
- **Commercial license required** for commercial products and revenue-generating
  companies

📄 [Read License Details](../../LICENSE.md)  
💳 [Purchase Commercial License](https://shepherdjs.dev/pricing)

---
_Source: https://npm.io/package/react-shepherd · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
