Stripe-like Dropdown Menu For Vue.js – Stripe Menu

Description:

Stripe Menu is a Vue.js component to create a minimal clean dropdown nav menu just like you see on the Stripe app.

How to use it:

1. Install and import the Stripe Menu.

import Vue from 'Vue'
import VueStripeMenu from 'vue-stripe-menu'
import 'vue-stripe-menu/dist/vue-stripe-menu.css'

2. Register the component.

Vue.use(VueStripeMenu)

3. Insert the stripe menu component into your template.

<template>
  <vsm-menu
    :menu="menu"
    @open-dropdown="onOpenDropdown"
    @close-dropdown="onCloseDropdown"
  >
    <li
      slot="before-nav"
      class="vsm-section"
    >
      <stripe-logo />
    </li>
    <!--Add a title using the slot:-->
    <!--<template #title="data">{{ data.item.title }}</template>-->
    <template #default="data">
      <component
        :is="data.item.content"
        class="content"
      />
      <component
        :is="data.item.secondary"
        class="content--secondary"
      />
    </template>
    <li
      slot="after-nav"
      class="vsm-section"
    >
      Sign In
    </li>
  </vsm-menu>
</template>

4. Define the menu items.

export default {
  components: {
    StripeLogo
  },
  data () {
    return {
      menu: [
        { title: 'Company', dropdown: 'company', content: DefaultContent, listeners: { mouseover: this.onMouseOver } },
        { title: 'Developers', dropdown: 'developers', content: HorizontalPrimaryContent, secondary: HorizontalSecondaryContent },
        { title: 'Products', dropdown: 'products', content: VerticalContent, element: 'span' },
        { title: 'Source', attributes: { href: 'app.vue', target: '_blank' } }
      ]
    }
  },
  methods: {
    onMouseOver (evt) {
      // console.log('mouse over', evt)
    },
    onOpenDropdown (el) {
      // console.log('open dropdown', el)
    },
    onCloseDropdown (el) {
      // console.log('close dropdown', el)
    }
  }
}

Download Details:

Author: Alexeykhr

Live Demo: https://alexeykhr.github.io/vue-stripe-menu/

Download Link: https://github.com/Alexeykhr/vue-stripe-menu/archive/master.zip

Official Website: https://github.com/Alexeykhr/vue-stripe-menu

Last Update: October 28, 2019

Install:

# Yarn
$ yarn add vue-stripe-menu

# NPM
$ npm install vue-stripe-menu --save

You Might Be Interested In:

Tags:

Add Comment