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

@becorps/vue-accordion

v1.0.1

Published

An accordion component for vue.js

Downloads

2

Readme

vue-accordion

An accordion component for vue.js.

Build Status codecov NPM NPM

Requirements

  • vue.js

Installation

Global installation

import Accordion from '@becorps/vue-accordion'
import '@becorps/vue-accordion/dist/accordion.css' // import stylesheet

Vue.component(Accordion)

In-component installation

import Accordion from '@becorps/vue-accordion'
import '@becorps/vue-accordion/dist/accordion.css' // import stylesheet

export default {
  components: {
    Accordion
  }
}

Usage

The Accordion is meant to be usable out of the box. Include it in your template and pass it an items prop.

<Accordion
  :items="items"
/>

Props

items

An Array of standard javascript objects. Each item must have the following properties:

  • title: the text displayed in the "trigger" element of the accordion item, i.e. the part that is always visible, even when the accordion item is collapsed.
  • content: the content displayed in the toggleable part of the accordion item, i.e. the part that is visible only when the accordion item is expanded.

showToggle

A boolean indicating whether a toggle button should be displayed in the title or trigger element. Note that the whole title/trigger element is clickable, whether or not the toggle is displayed. The toggle simply acts as a visual clue to the user that the element is expandable/collapsible.

Default value: true

transition

It is a transition for opening/closing accordion item. It sets The transition-timing-function css property when opening and closing item

Default value: ease

duration

It is a duration of the transition in millisecond(ms).

Default value: 350

Customization

The Accordion component is designed with minimal styling.

SCSS

Instead of importing the css file in component or main.js, you can also import scss file into your app scss file.

@import '~@becorps/vue-accordion/src/assets/scss/accordion.scss';

Slots

vue-accordion provides scoped slots in order to customize the accordion.

Scoped Slot title


It customize title of accordion.

<Accordion
  :items="items"
>
  <template v-slot:title="{index, item}">
    <h3>{{ index + 1 }}. {{ item.title }}</h3>
   </template>
</Accordion>

Scoped Slot content

It customize content of accordion.

<Accordion
  :items="items"
>
  <template v-slot:content="{index, item}">
    <pre>{{ item.title }}</pre>
   </template>
</Accordion>

Scoped Slot toggle

It customize accordion toggle button/icon.

<Accordion
  :items="items"
>
  <template v-slot:toggle="{active}">
    <button v-if="active">collapse</button>
    <button v-else>expand</button>
   </template>
</Accordion>