An accessible accordion component to help structure large amounts of content on a page
* Standalone JS is used on projects that are not set up to handle
ES6. To use this version you will need to download the UMD bundle the NPM and pull it into your
project. The same process should be
followed with the CSS if it cannot process through the NPM package.
Since version 1.1, the component supports nested accordions. The markup remains the same.
This component accepts two arguments, the selector for the accordion container and an object containing optional callbacks.
npm install @10up/component-accordion --save
List of APIs for this component
Called after the accordion is initialized on page load
options.Called when an accordion item is opened
Called when an accordion item is closed
Called when an accordion item is toggled
List of avaliable methods
Destroys the component, removing event listeners and any extra markup and attributes.