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.
npm install vue-badger-accordionVerified import paths — ran on the pinned version, not inferred.
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.
For Vue 3 projects, seek a dedicated Vue 3 accordion component or a Vue 3 compatible version of badger-accordion if one exists.
Refer to the original `badger-accordion` GitHub repository at https://github.com/stuartjnelson/badger-accordion for options and methods documentation.
Continue using the `slot="header"` and `slot="content"` attributes with `<template>` tags within this component in Vue 2 projects. No change needed for this package, but be mindful of Vue 3 slot syntax (`v-slot`) for future projects.
For simple icons, pass HTML strings like `<i class="fas fa-chevron-down"></i>`. For advanced scenarios, define a Vue component with an 'opened' prop and pass its name to the `iconComponent` prop.
Ensure you either call `Vue.component('BadgerAccordion', BadgerAccordion)` and `Vue.component('BadgerAccordionItem', BadgerAccordionItem)` globally, or include them in the `components` option of your parent component.Add a `ref="myAccordion"` attribute to your `<badger-accordion>` component and ensure you access its methods only after the component is mounted, for instance, in a `mounted()` lifecycle hook: `this.$refs.myAccordion.open(0)`.
Verify the syntax of the options object passed to the `:options` prop (e.g., `:options="{initialOpen: true}"`). Crucially, consult the original `badger-accordion` library's documentation for the correct and full list of available options.