Vue Badger Accordion

2.0.2 · maintenance · verified Sun Apr 19

This package provides a Vue 2.x component wrapper for the standalone `badger-accordion` library. It enables developers to easily integrate accessible accordion UI elements into their Vue 2 applications. The current stable version is 2.0.2, which primarily focuses on minor bug fixes and feature additions for the Vue 2 ecosystem. This package is a direct wrapper, exposing most of the underlying `badger-accordion` library's options, methods, and events, differentiating it by providing a thin Vue layer rather than a re-implementation. Its release cadence appears to be slow, consistent with its role as a wrapper for an external library and its ties to Vue 2. It offers flexibility for custom state indicators and event handling, making it suitable for projects requiring a highly customizable Vue 2 accordion solution.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates the two primary methods for integrating `BadgerAccordion` and `BadgerAccordionItem` components into a Vue 2 application: global registration via `Vue.component` and local registration within another Vue component's `components` option, preparing them for use in your templates.

import Vue from 'vue';
import { BadgerAccordion, BadgerAccordionItem } from 'vue-badger-accordion';

// Option 1: Global registration (common in smaller apps or plugins)
Vue.component('BadgerAccordion', BadgerAccordion);
Vue.component('BadgerAccordionItem', BadgerAccordionItem);
console.log('BadgerAccordion and BadgerAccordionItem globally registered.');

// Option 2: Local registration (common in component-based apps)
// In a typical Vue SFC (<script> section of a .vue file), you would do:
const MyAccordionParentComponent = {
  template: `
    <badger-accordion>
      <badger-accordion-item>
        <template slot="header">Item 1 Header</template>
        <template slot="content">Item 1 Content</template>
      </badger-accordion-item>
    </badger-accordion>
  `,
  components: {
    BadgerAccordion,
    BadgerAccordionItem
  }
};
console.log('BadgerAccordion and BadgerAccordionItem are available for local registration in Vue components.');

// This code demonstrates the import and registration process.
// To see a full example, you would integrate this into a Vue 2 application with an HTML template.

view raw JSON →