swup swup Plugins
GitHub swup on GitHub

Plugins

Swup is small by design. Extended features can be added via plugins.

See below for a list of all official plugins.

Installing plugins

Install and import the plugin via npm and your bundler:

npm install @swup/scroll-plugin
npm install @swup/scroll-plugin
import Swup from 'swup';
import SwupScrollPlugin from '@swup/scroll-plugin';
import Swup from 'swup';
import SwupScrollPlugin from '@swup/scroll-plugin';

Enable the plugin at initialisation of swup by including it in the options:

const swup = new Swup({
  plugins: [new SwupScrollPlugin()]
});
const swup = new Swup({
  plugins: [new SwupScrollPlugin()]
});

Alternatively, you can use swup's use & unuse methods to add or remove plugins after intialization.

const swup = new Swup();
swup.use(new SwupScrollPlugin());
const swup = new Swup();
swup.use(new SwupScrollPlugin());

Accessing plugin instances

Use swup's findPlugin method to find and manipulate plugin instances directly.

const pluginInstance = swup.findPlugin('SwupScrollPlugin');
const pluginInstance = swup.findPlugin('SwupScrollPlugin');