Nice browser. Is it antique?
No, seriously - your browser is so old that some features of patternplate don't work as expected.
Don't worry - you can either continue with a restricted version or install an up-to-date browser.
We messed up.
Sorry, but your user experience might be affected.
- Try reloading the page
- Report the problem at

04 - Creating Plugins@1.2.0

It's time to learn something about navigation.

Time invest: 10 Minutes ––– 👩‍🎓 Level: Intermediate

What to expect

Interacting with timeline based libraries can be tricky. Learn how Stickyroll uses hash-links to allow easy navigation. In about 10 minutes we will build a small Skip Component that allows us to skip the entire view.

We will …

  • … install an additional stickyroll package
  • … create a new file with a component
  • … add the component to our existing app

You'll need

You should have finished the second or third course course.

Building plugins with context and utils

Follow these 3 simple steps to build your first Plugin.

1. Installing Utils

While in your app folder my-app, run a single command:

npm install --save @stickyroll/utils

2. Creating a Plugin

Create a file my-app/src/Skip.js in your text editor and paste this code. This creates a simple Link that allows users to skip the entire Content.

To ensure that this Plugin works with and without context, we need to add a component to make the switch for us.

To get access to Stickyrolls context we need to import { Listener } from "@stickyroll/stickyroll".
With the helper of Stickyrolls scrollTo() we can trigger a scroll to the desired section of our app.
We will use assert() to check if prefix is a string, when no context is being used.

import { Listener } from "@stickyroll/stickyroll";
import { assert, scrollTo } from "@stickyroll/utils";
import React from "react";

export const SkipBase = props => {
    const handleClick = e => {
        scrollTo(`${props.prefix}/skip`,, {
            noFocus: true, 
            noHash: true

    return (

const Skip = props => {
    if (props.useContext) {
        return (
                {context => (
                    <SkipBase prefix={context.anchors} />
    assert(props.prefix, "string");
    return <SkipBase prefix={props.prefix} />;

export default Skip;

We can now use this Plugin with or without context

Context is only available when using the child function. We will talk about the render property in a later course.

3. Using the plugin

We can now use the plugin to allow users to skip the entire view.

We need to do a few steps to use our component.

Import our plugin

import Skip from "./Skip";

and add this new snippet

<Skip useContext={true}/>

If you already added anchors in "Configure Stickyroll", you can skip this part.

Now we have to add an attribute to Stickyroll.

<Stickyroll pages={headlines} anchors=""/>

Setting anchors injects elements with corresponding IDs to allow hash navigation.


  • "" => ""
  • "examples" => ""
  • "!" => "!/1"
  • "!/examples" => "!/examples/1"

Your App.js should now look like this:

import React from 'react';
import {Stickyroll} from '@stickyroll/stickyroll';
import PageCounter from "./PageCounter";
import ProgressCounter from "./ProgressCounter";
import Skip from "./Skip";

const headlines = [
    "Hello World!",
    "Hello React!",
    "Hello Stickyroll!",
    "Let's continue with the next lesson!"

const App = () => {
    return (
        <Stickyroll pages={headlines} anchors="">
            {({pageIndex}) => {
                return (
                    <Skip useContext={true}/>

export default App;


Next steps

You can now repeat the same process with for all other pages to allow users to jump directly to each page. The anchor targets are already set up. Using the same scrollTo function, you can build complex navigation components.

We already built a pager component with styled-components. We will look at the cosmetic components in the next step.

You should now be able to do this on your own.

If anything is missing or seems unclear feel free to open an issue in our github repo.

Thank you