@10up/component-accordion
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

10up Accordion component

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( { link, content, heading } ) {
		console.log( 'onOpen callback' );
	},
	onClose: function( { link, content, heading } ) {
		console.log( 'onClose callback' );
	},
	onToggle: function( { link, content, heading } ) {
		console.log( 'onToggle callback' );
	}
} );

Demo

Example implementations at: https://baseline.10up.com/component/accordion/

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?

Readme

Keywords

none

Package Sidebar

Install

npm i @10up/component-accordion

Weekly Downloads

475

Version

2.0.1

License

MIT

Unpacked Size

83.5 kB

Total Files

22

Last publish

Collaborators

  • darylldoyle
  • fabiankaegy
  • brandwaffle
  • eugene-manuilov
  • christianc1
  • nicholasio
  • joesnellpdx
  • tlovett1
  • devinle