Home

Awesome

DEPRECATED see cerijs and ceri-side-nav

vue-side-nav

for the best user-experience when navigating your side, you can use a responsive side-nav.

Demo

Install

npm install --save-dev vue-side-nav
// vue touch@next - not released on npm currently
npm install --save-dev git://github.com/vuejs/vue-touch.git#next

// vue@1.0
npm install --save-dev vue-side-nav@1 vue-touch@1

or include build/bundle.js.

Usage

# somewhere
Vue.use(require('vue-touch'))

# in your component
components:
  "side-nav": require("vue-side-nav")
# or, when using bundle.js
components:
  "side-nav": window.vueComps.sideNav
<side-nav>
  <li>First Text<li>
</side-nav>
<!-- sibling elements will be set to margin-left:240px for `fixed` and `is-fixed=true` -->
<container>
</container>

For examples see dev/.

ERROR: Module build failed: SyntaxError: 'with' in strict mode

Currently buble is injecting strict mode in all processed js files. The down to ES5 compiled component contains with, which is forbidden in strict mode. Buble is used, for example, in rollup, which is used in laravel.

If you are running in this problem, make sure to exclude this component from processing with buble.

Props

Nametypedefaultdescription
widthNumber240width of the side-nav
fixed-screen-sizeNumber992Used with fixed. Above this size, the menu will stay opened.
not-dismissableBooleanfalseA click on the overlay will not dismiss it
close-on-clickBooleanfalseAny click within the side-nav will close it
fixedBooleanfalseshould always show on large screens
is-openedBooleanfalseopens or closes the side-nav - use in conjuction with toggled event
rightBooleanfalseattach to the right side instead of the left
transitionFunctionno-transitionwill be called on open and close with {el,style,cb}.
classvue class["side-nav"]class of the ul
stylevue style[]style of the ul
idString-id of the ul
opacityNumber0.5opacity of the overlay
z-indexNumber1000minimum zIndex of the overlay, cannot be lower than 100 (see vue-overlay for specifics)

Menu will be visibile when either is-fixed or is-opened is true.

Events

Namedescription
before-enterwill be called before open animation
after-enterwill be called when opened
before-leavewill be called before close animation
after-leavewill be called when closed
fixed(isFixed:Boolean)emitted when menu get fixed or unfixed on large screen.
toggled(isOpened:Boolean)emitted when menu gets opened or closed.

Transition

You can provide a transition like this:

Velocity = require("velocity-animate")

template: "<side-nav transition='moveIn'></side-nav>",
methods:{
  moveIn: function ({el,style,cb}) {
    Velocity el, "stop"
    Velocity el, style, {
      duration: 300,
      queue: false,
      easing: 'easeOutQuad',
      complete: cb
    }
  }
}

The background is managed by vue-overlay. See here for an example on how to change its fading function.

Changelog

Development

Clone repository.

npm install
npm run dev

Browse to http://localhost:8080/.

License

Copyright (c) 2016 Paul Pflugradt Licensed under the MIT license.