Installation
Install Directly
Section titled “Install Directly”npm install shepherd.js --saveyarn add shepherd.jspnpm add shepherd.jsbun add shepherd.jsstyles
Section titled “styles”Don’t forget to add your styles
import 'shepherd.js/dist/css/shepherd.css';GitHub Releases
Section titled “GitHub Releases”Whenever we release a new version, the contents of the dist are uploaded
to the release in GitHub. You can find those assets here.
jsDelivr CDN
Section titled “jsDelivr CDN”You can use jsDelivr to pull down any release from npm. shepherd.mjs is an ES module and defines no global, so
import it:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/shepherd.js@16/dist/css/shepherd.css"/><script type="module"> import Shepherd from 'https://cdn.jsdelivr.net/npm/shepherd.js@16/dist/js/shepherd.mjs';
const tour = new Shepherd.Tour();</script>JS Framework Wrappers
Section titled “JS Framework Wrappers”We strive to make it easy to use Shepherd in all the major frameworks, and have written wrappers to facilitate this.
Upgrading from Shepherd 15
Section titled “Upgrading from Shepherd 15”Shepherd positions steps with its own engine and no longer runs Floating UI
middleware or platforms. floatingUIOptions is replaced by positionOptions,
which takes four keys. A step that still passes floatingUIOptions logs a
warning and is positioned as if it had none.
| Shepherd 15 | Now |
|---|---|
floatingUIOptions: { strategy: 'fixed' } |
positionOptions: { strategy: 'fixed' } |
floatingUIOptions: { middleware: [offset(12)] } |
positionOptions: { offset: 12 } |
offset({ mainAxis: 4, crossAxis: 8 }) |
positionOptions: { offset: { mainAxis: 4, crossAxis: 8 } } |
shift({ padding: 24 }) or flip({ padding: 24 }) |
positionOptions: { padding: 24 }, for both |
Removing flip() to keep a side |
positionOptions: { flip: false } |
placement in floatingUIOptions |
attachTo.on |
hide(), size(), inline(), custom middleware, platform |
No replacement |
Shepherd 15 ran a consumer’s offset() after its own flip() and shift().
offset now runs first, as Floating UI recommends, so flipping and shifting
account for the gap. Remove @floating-ui/dom from your
dependencies if nothing else uses it. See
StepOptionsPosition
for each key.