All Projects → mbj36 → Vue Burger Menu

mbj36 / Vue Burger Menu

Licence: mit
🍔 An off-canvas sidebar Vue component - https://vue-burger-menu.netlify.com/

Projects that are alternatives of or similar to Vue Burger Menu

Vue Cnodejs
基于vue.js重写Cnodejs.org社区的webapp
Stars: ✭ 3,065 (+372.99%)
Mutual labels:  vue-components, vuejs2
Vue Goodshare
🍿 Vue.js component for social share. A simple way to share a link on the pages of your website in the most popular (and not so) social networks. Powered by goodshare.js project.
Stars: ✭ 345 (-46.76%)
Mutual labels:  vue-components, vuejs2
Vue Project
基于vue-cli构建的财务后台管理系统(vue2+vuex+axios+vue-router+element-ui+echarts+websocket+vue-i18n)
Stars: ✭ 301 (-53.55%)
Mutual labels:  vue-components, vuejs2
Vuejs Component Style Guide
Vue.js Component Style Guide
Stars: ✭ 2,796 (+331.48%)
Mutual labels:  vue-components, vuejs2
Vue Gl
Vue.js components rendering 3D WebGL graphics reactively with three.js
Stars: ✭ 434 (-33.02%)
Mutual labels:  vue-components, vuejs2
Formvuelar
Vue form components with server-side validation in mind
Stars: ✭ 263 (-59.41%)
Mutual labels:  vue-components, vuejs2
Quasar
Quasar Framework - Build high-performance VueJS user interfaces in record time
Stars: ✭ 20,090 (+3000.31%)
Mutual labels:  vue-components, vuejs2
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (-60.96%)
Mutual labels:  vue-components, vuejs2
Vuesax
New Framework Components for Vue.js 2
Stars: ✭ 5,293 (+716.82%)
Mutual labels:  vue-components, vuejs2
Vue Material Dashboard
Vue Material Dashboard - Open Source Material Design Admin
Stars: ✭ 403 (-37.81%)
Mutual labels:  vue-components, vuejs2
Vuelayers
Web map Vue components with the power of OpenLayers
Stars: ✭ 532 (-17.9%)
Mutual labels:  vue-components, vuejs2
Vue Swatches
🎨 Help the user picking beautiful colors!
Stars: ✭ 456 (-29.63%)
Mutual labels:  vue-components, vuejs2
Tui
This is a high quanlity components library for VUE
Stars: ✭ 258 (-60.19%)
Mutual labels:  vue-components, vuejs2
Mui Vue2
mui+mint+vue2.x+vue-router+vuex+webpack最终打包成原生apk的app项目,样式使用vue移动端mint ui框架,原生手机能力偏重于mui框架,欢迎star!
Stars: ✭ 278 (-57.1%)
Mutual labels:  vue-components, vuejs2
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (-90.12%)
Mutual labels:  vuejs2, vue-components
Vue Page Transition
A lightweight Vue.js plugin for page / route transitions.
Stars: ✭ 311 (-52.01%)
Mutual labels:  vue-components, vuejs2
Vue Material Kit
Vue Material Kit - Open Source Material Design UI Kit
Stars: ✭ 231 (-64.35%)
Mutual labels:  vue-components, vuejs2
Vue Tabs
Simplified bootstrap tabs
Stars: ✭ 241 (-62.81%)
Mutual labels:  vue-components, vuejs2
Vue Video Player
🎞 @videojs component for @vuejs
Stars: ✭ 4,026 (+521.3%)
Mutual labels:  vue-components, vuejs2
Vue Touch Ripple
👆 Touch ripple component for @vuejs
Stars: ✭ 443 (-31.64%)
Mutual labels:  vue-components, vuejs2

vue-burger-menu code style: prettier

npm

Tweet

An off-canvas sidebar Vue component with a collection of effects and styles using CSS transitions and SVG path animations.

Demo & examples

Live demo - https://vue-burger-menu.netlify.com/

To build the examples locally, run:

npm i
npm run serve
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

import { Slide } from 'vue-burger-menu'  // import the CSS transitions you wish to use, in this case we are using `Slide`

export default {
    components: {
        Slide // Register your component
    }
}

In your template

<template>
    <Slide>
      <a id="home" >
        <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
  • ScaleDown
  • ScaleRotate
  • Reveal
  • Push
  • PushRotate

ATTENTION - the below animations are in WIP

  • FallDown
  • Stack
  • Elastic
  • Bubble

Properties

Some animation require certain other elements on your page

  • Page wrapper - an element wrapping the rest of the content on yur page, placed after the menu component
<Menu/>

<main id="page-wrap">
.
.
</main>

  • Outer container called app - an element containing everything including the menu component
<div id="app">
    <Menu/>
    <main id="page-wrap">
    .
    .
    .
    </main>
</div>

Check this table to see which animations require these elements:

Animation pageWrapId appId
Slide
Push
PushRotate
ScaleDown
ScaleRotate
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.

<Slide right/>

Width

You can specify the width of the menu with the width prop. The default is 300px

<Slide width="400">

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

// To render the menu open

<Slide isOpen>

Menu events

If you want to get a notification when the menu open or close you can use the openMenu and closeMenu notifications. This way you can update your application state when the menu open or close

// To bind the open and close events

<Slide
  @openMenu="handleOpenMenu"
  @closeMenu="handleCloseMenu"
>

Close on Outside Click

You can turn off the menu closing when an an outside click is triggered with disableOutsideClick.

<Slide disableOutsideClick>

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.

<Slide disableEsc />

Close on Navigation

By default, the menu will not close when a link inside the menu is clicked. To disable this behavior, you can pass the closeOnNavigation prop. This is useful in cases where you want the menu to close when a navigation link is clicked as this then stops the user having to make an extra click to close the menu.

<Slide :closeOnNavigation="true" />

Overlay

You can turn off the default overlay with noOverlay.

<Slide noOverlay />

Burger Icon and Cross Icon

You can disable both icons by passing burgerIcon and crossIcon to false. This can be useful if you want to keep the menu open and don't want the user to close the menu

<Slide :burgerIcon="false" :crossIcon="false"/>

Styling

Visual styles (color, font etc) need to be supplied with the help of CSS

CSS

The component has following helper class

 .bm-burger-button {
      position: fixed;
      width: 36px;
      height: 30px;
      left: 36px;
      top: 36px;
      cursor: pointer;
    }
    .bm-burger-bars {
      background-color: #373a47;
    }
    .line-style {
      position: absolute;
      height: 20%;
      left: 0;
      right: 0;
    }
    .cross-style {
      position: absolute;
      top: 12px;
      right: 2px;
      cursor: pointer;
    }
    .bm-cross {
      background: #bdc3c7;
    }
    .bm-cross-button {
      height: 24px;
      width: 24px;
    }
    .bm-menu {
      height: 100%; /* 100% Full-height */
      width: 0; /* 0 width - change this with JavaScript */
      position: fixed; /* Stay in place */
      z-index: 1000; /* Stay on top */
      top: 0;
      left: 0;
      background-color: rgb(63, 63, 65); /* Black*/
      overflow-x: hidden; /* Disable horizontal scroll */
      padding-top: 60px; /* Place content 60px from the top */
      transition: 0.5s; /*0.5 second transition effect to slide in the sidenav*/
    }

    .bm-overlay {
      background: rgba(0, 0, 0, 0.3);
    }
    .bm-item-list {
      color: #b8b7ad;
      margin-left: 10%;
      font-size: 20px;
    }
    .bm-item-list > * {
      display: flex;
      text-decoration: none;
      padding: 0.7em;
    }
    .bm-item-list > * > span {
      margin-left: 10px;
      font-weight: 700;
      color: white;
    }

Browser Support

Chrome and Firefox have full support, but Safari and IE have strange behavior for some of the menus.

Author

© Mohit Bajoria

License

MIT

Like it ? it

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].