Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

10up/component-accordion

Repository files navigation

10up Accordion component

DEPRECATED. Please go to https://github.com/10up/component-library

Support Level License: MIT Build Status

View official documentation for this package

Installation

npm install --save @10up/component-accordion

Usage

CSS Imports

@import url("@10up/component-accordion");

The styles can be imported into your existing codebase by using PostCSS imports, or by including the standalone CSS file in your project.

JavaScript

Create a new instance by supplying the selector to use for the accordion and an object containing any necessary callback functions.

import Accordion from '@10up/component-accordion';

new Accordion( '.accordion', {
	onCreate: function() {
		console.log( 'onCreate callback' );
	},
	onOpen: function() {
		console.log( 'onOpen callback' );
	},
	onClose: function() {
		console.log( 'onClose callback' );
	},
	onToggle: function() {
		console.log( 'onToggle callback' );
	}
} );

Demo

Example implementations at: https://10up.github.io/accordion-animate/demo/

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Like what you see?