npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

angular-bayan

v1.0.1

Published

Easily customizable accordion-like module

Readme

angular-bayan

Easily customizable accordion-like module for Angular
Shows the first line of the content in the collapsed state

Demo

http://gerrproger.github.io/angular-bayan

Browser support

Works on IE9+ in addition to other modern browsers such as Chrome, Firefox, and Safari

Dependencies

Only Angular 1.2+

Usage

Get angular-bayan.

  • via npm: npm install angular-bayan
  • or via Bower: bower install angular-bayan

Include it in your application.

<script src="/angular-bayan/dist/angular-bayan.min.js"></script>

Add the module angular-bayan as a dependency to your app module.

var myapp = angular.module('myapp', ['angularBayan']);

You can now start using the angular-bayan directives.

<bayan>
  <bayan-header>Title</bayan-header>
  <bayan-content>
    <div>Element1</div>
    <div>Element2</div>
    <div>Element3</div>
    ...
  </bayan-content>
</bayan>

Directives can be referenced as element names or attributes. bayan-header should contain the header of an accordion. bayan-content should contain elements, it would be collapsed.

Directive bayan-content has two settings: bayan-content-offset and bayan-content-collapsed.
Pass to bayan-content-offset number (in px) which would be added to the content height in the collapsed state.
By default Bayan is not collapsed but you can change it by setting bayan-content-collapsed to true.

<bayan-content bayan-content-collapsed="true" bayan-content-offset="10">
  ...
</bayan-content>

By default Bayan looks for elements to collapse right inside bayan-content block. And in the collapsed state hides all lines inside except the first one. But you can manually specify the parent block in which your elements contained. Just add to the parent block bayan-content-target attribute.

<bayan-content>
  <ul bayan-content-target>
    <li>Element1</li>
    <li>Element2</li>
    <li>Element3</li>
    ...
  </ul>
</bayan-content>

Bayan sets his object in the scope. So you can use this to determinate collapsed state or recalculate the height of the content.

<bayan>
  <bayan-header ng-bind="bayan.opened ? 'Collapse' : 'Expand'"></bayan-header>
  <bayan-content>
  ...
  </bayan-content>
  <button ng-click="bayan.update()">Update height</button>
</bayan>

To reinitialize the height of the Bayan content (if elements changed) you can just trigger bayan:update event.

$scope.$broadcast('bayan:update');

Bayan's header and content can be placed anywhere inside bayan. For example bayan-header could be inside bayan content.

Bayan use max-height to control the height. So you can easily add animation using transitions.

License

Released under the terms of MIT License