vue-burger-menu
An off-canvas sidebar Vue component with a collection of effects and styles using CSS transitions and SVG path animations.
To build the examples locally, run:
yarn
yarn serve
Then open localhost:8080
in a browser
Installation
npm install vue-burger-menu --save
yarn add vue-burger-menu
Usage
Items should be passed as child elements of the components
In your template
<template>
<Slide>
<a id="home" href="#">
<span>Home</span>
</a>
</Slide>
</template>
Animations
The example above imported slide
which renders a menu that slides in on the page when the burger icon is clicked. To use a different animation you can subsitute slide with any of the following
- slide
ATTENTION - the below animations are in WIP
- stack
- elastic
- bubble
- push
- pushRotate
- scaleDown
- scaleRotate
- fallDown
- reveal
Position
The menu opens from left by default. To have it open from the right, use the right
prop. It's just a boolean so you don't need to specify a value.
Width
You can specify the width of the menu with the width
prop. The default is 300px
Open state
You can control whether the sidebar is open or closed with the isOpen
prop. This is useful if you need to close the menu after a user clicks on an item in it, for example, or if you want to open the menu from some other button in addition to the standard burger icon. The default value is false
Close on Escape
By default, the menu will close when the Escape key is pressed. To disable this behavior, you can pass the disableCloseOnEsc
prop. This is useful in cases where you want the menu to be open all the time, for example if you're implementing a responsive menu that behaves differently depending on the browser width.
Overlay
You can turn off the default overlay with noOverlay
.
Styling
Visual styles (color, font etc) need to be supplied with the help of CSS
CSS
The component has following helper class
Browser Support
Chrome and Firefox have full support, but Safari and IE have strange behavior for some of the menus.