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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngex-accordion

v12.2.1

Published

A simple and light-weight accordion for applications with Angular versions 8 - 13.

Downloads

2

Readme

ngex-accordion

A simple and light-weight accordion for applications with Angular versions 8 - 13.

The library was generated with Angular CLI version 12. It still uses the ViewEngine, instead of Ivy Partial option, for the better backward compatibility.

The ngex-accordion uses the directive, rather than component, design and pattern practices. The component pattern of the Angular accordion implementation limits the consumer code for additional and more hierarchical HTML elements with complex data bindings and styles. The directive pattern of the ngex-accordion, however, overcomes these limits and works better in the real production web applications. Please stay tuned for my blog post that details those design and pattern comparisons.

Installation

Run npm install ngex-accordion to add the library into your project directory, or add "ngex-accordion": "~12.2.1" to the package.json file and then run npm install to update the existing package.

How to Use

  1. Import AccordionModule to your app.module.ts

    import { AccordionModule } from 'ngex-accordion';

  2. Import AccordionDirective to your component to use the accordion:

    import { AccordionDirective } from 'ngex-accordion';

  3. Define isOpenAll class-level flag and assign its value in your component to ues the accordion:

    isOpenAll: boolean = <false|true>;

The value false sets to always expand one item at a time, whereas true keeps all items expanded if you have expended any.

  1. Specify all required directives with your code in the HTML template. You can freely use all your own options and styles in your component template. There is no library-rendered component templates to limit your UI display. Below is the base template with the ngex-accordion directives.

    <div accordion="isOpenAll">	
        <div *ngFor="let item of dataList; let idx = index">                
            <div accordionItem [index]="idx" >
                <div accordionHeader>
                    {{item.key}}
                    <i class="accordion-toggle-btn fa fa-chevron-right"
                       [class.accordion-active-icon]="accordion.isActiveItem(idx)">
    	    </i>
    	</div>                    
                <div [class.accordion-expanded]="accordion.isActiveItem(idx)" >
                    <div *ngFor="let subItem of item.value">
                        {{subItem.text}}
                    </div>
                 </div>
             </div>
         </div>	
    </div>

Source Code and Demo Application

The source code and demo application can be downloaded from the github repository. You can reference the HTML template in the app.component.html and CSS styles in the app.component.css for your application use.