Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ay-accordion

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ay-accordion

A mobile-friendly, jank-free accordion directive for Angular 1.x

  • 1.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-95.71%
Maintainers
2
Weekly downloads
 
Created
Source

ayAccordion

A mobile-friendly, jank-free accordion directive for Angular 1.x.

Copyright © 2016 Ayogo Health Inc.

Features

  • Keyboard accessible and screen-reader friendly
  • Support for single/multiple expanded regions
  • Smooth animation on desktop and mobile
  • Per-section open/close events
  • Supports IE 10+, Safari 6+, Edge, Chrome, Firefox, iOS 6+, and Android 4.4+

Usage

To get started, install the package from npm: npm install ay-accordion.

Basic usage

Add a script tag to your page to reference the accordion.js file:

<script src="node_modules/ay-accordion/dist/accordion.js"></script>

Reference the module in your Angular app's dependencies:

angular.module(myApp, ['ayAccordion'])

ES5 with Browserify

Install the browserify-ngannotate transform: npm install browserify-ngannotate

Reference the module in your Angular app's dependencies:

var ayAccordion = require('ay-accordion').default;

angular.module(myApp, [ayAccordion])

ES6 / TypeScript

Reference the module in your Angular app's dependencies:

import ayAccordion from 'ay-accordion';

angular.module(myApp, [ayAccordion])

A TypeScript module definition is included.

Directives

<div ay-accordion-root multiple>
  <div ay-accordion open on-toggle="ctrl.accordionToggle(state)">
    <b ay-accordion-header>Panel 1 (Click to open)</b>
    <div>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    </div>
  </div>
</div>

ayAccordionRoot

This directive wraps the entire accordion, as well as any content below the accordion that needs to be pushed down when accordion sections open and close.

  • multiple: This attribute allows multiple accordion sections to be open at the same time (default is only a single section expanded at a time).

ayAccordion

This directive manages a single expanding/collapsing accordion section, including the title content shown when it is collapsed.

  • open: This attribute will make the section expanded by default. You can also use ng-open to set this attribute dynamically.

  • on-toggle: This attribute specifies a callback function to be run when the section is expanded or collapsed. The state argument is a boolean representing if the section is open.

ayAccordionHeader

This directive wraps the title of the accordion section, and attaches the event handlers to expand the section when clicked.

Styling

For the accordion to expand/collapse as intended, you'll need to add something like the following to your stylesheet:

[hidden] {
    display: none;
}

[ay-accordion] {
    overflow: hidden;
    height: 30px;
}

[ay-accordion][open] {
    height: auto;
}

Notes

Released under the terms of the MIT License.

This project would not have happened without the knowledge and support of Ada Rose Edwards, in particular the following two posts:

Keywords

FAQs

Package last updated on 18 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc