npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-accordion

v1.0.0

Published

Simple accordion menu component for Vue.js

Downloads

296

Readme

vue-accordion

Simple accordion menu component for Vuejs

Check it out live!

Note

The API has changed. Check v0.0.3 documentation if you use the old version.

Install

NPM / Yarn

Install the package:

npm install vue-accordion

Then import it in your project

import Vue from 'vue'
import {vueAccordion} from 'vue-accordion'

Vue.component('vue-accordion', vueAccordion)

Browser global

Just include vue & vue-accordion

<script scr="path/to/vue.js"></script>
<script src="path/to/dist/vue-accordion.js"></script>

Then register the component:

<script>
  Vue.component('vue-accordion', vueAccordion)
  
  var vm = new Vue({
    ...
  });
</script>

Usage

Simply use it like so:

<vue-accordion :items="items" :accordionClass="acClass" :styles="styles"></vue-accordion>

Structure

Once the accordion has been rendered, it'll create the following structure:

<div class="vue-accordion">
  <ul>
    <!-- First menu item-->
    <li>
      <a>
        <h2>...</h2>
        <p>...</p>
      </a>
    </li>
    <!-- Second menu item-->
    <li>
      <a>
        <h2>...</h2>
        <p>...</p>
      </a>
    </li>
    ...
  </ul>
</div>

All CSS is based uppon this structure.

.vue-accordion {
  ...
}

.vue-accordion ul {
  ...
}

...

.vue-accordion ul li a h2 {
  ...
}

If you want to modify the styling, take a look at the accordionClass and styles props.

Options

items

Mandatory. An array of objects to create the panels inside the accordion. Each object must have this structure:

{
  title: 'First',
  text: 'text',
  url: '#',
  image: '/images/one.jpg'
}

Take into consideration the width of the accordion and the images you use. If the image is shorter, you'll see a an awful grey background.

accordionClass

Optional. A string bounded to the class attribute of the main div. Defaults to vue-accordion.

styles

Optional. An object whose keys are other objects containing specific CSS properties to be bound to the elements created inside the accordion:

{
  // this will be bound to the style attribute of all `div`s inside the accordion
  div: {
    height: '350px'
  },
  // this will be bound to the style attribute of all `ul`s inside the accordion
  ul: {
    color: '#F00'
  },
  // this will be bound to the style attribute of all `li`s inside the accordion
  li: {
    fontSize: '15px'
  },
  // this will be bound to the style attribute of all `a`s inside the accordion
  a: {
    padding: '30px'
  },
  // this will be bound to the style attribute of all `h2`s inside the accordion
  h2: {
    marginTop: '100px'
  },
  // this will be bound to the style attribute of all `p`s inside the accordion
  p: {
    textTransform: 'uppercase'
  }
}

TODO

  • Tests
  • Router-link

CREDITS

Most of the CSS belongs to this guy