Skip to content

KevinAst/gitbook-plugin-folding-menu

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

gitbook-plugin-folding-menu

This gitbook plugin manages large left-nav menus by visualizing only one section at a time (the active section).

NPM Version Badge

At a Glance

Overview

The high-level points of interest are:

  • On initial display, only the top-level menu items are displayed.

  • Navigating to a section with sub-content will dynamically expand it, collapsing any prior section.

  • The active section will expose the entire sub-menu depth (i.e. all it's ancestry, not just direct children).

  • Navigating between sections continues to expand only the active section (expanding the active section while collapsing any section previously expanded).

  • Animation is used to make the user experience more intuitive (i.e. they can visually see what is happening)!

  • Sections that are composed of multiple pages are supported.

This plugin has the effect of "taming" a big unruly menu structure, by exposing only one section at a time, making it more intuitive for end-user consumption.

You can see this in action at: https://feature-u.js.org/ (one of my open source projects).

This project is a significant improvement on other similar plugins.

Install

  1. Add the "folding-menu" plugin to your book.json file:

    book.json

    {
      ...
      "plugins": [
        ... other plugins you may be using
        "folding-menu"
      ]
      ...
    }
  2. Install the plugin using one of the following options (based on your gitbook usage):

    • For https://legacy.gitbook.com/ usage, plugins are automatically installed.

    • For local gitbook usage run gitbook install to install and prepare all plugins for your books:

      gitbook install
    • For technical users (ex: open source documentation), install the plugin to your devDependencies as follows:

      npm install --save-dev gitbook-plugin-folding-menu

Configuration

You may optionally supply the following configuration to this plugin:

    book.json

    {
      ...
      "pluginsConfig": {
        "folding-menu":	{
          "animationDuration": 500,
          "sticky":            true
        }
      }
      ...
    }
  • animationDuration - The animation duration in mills ... use 0 (zero) to disable animation ... DEFAULT: 400

  • sticky - Leave the last section expanded when a the current active section has NO sub-content ... DEFAULT: false

Revision History

Release What When
v1.0.1 Added Configuration September 8, 2018
v1.0.0 Initial Release September 7, 2018

v1.0.1 - Added Configuration (September 8, 2018)

v1.0.0 - Initial Release (September 7, 2018)

About

GitBook plugin that "tames" large left-nav menus by visualizing one section at a time.

Resources

License

Stars

Watchers

Forks

Packages

No packages published