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

ng-collapsible

v0.0.2

Published

A simple Angular component (as directive) for collapse. No dependencies, no need for Bootstrap or jQuery.

Downloads

138

Readme

Ng-Collapsible

A simple Angular component (as directive) for collapse. No dependencies, no need for Bootstrap or jQuery. See working example: here.

How to Use

  • Install: npm i ng-collapsible --save
  • Import to your @NgModule or any other module file : import { NgCollapsibleModule } from 'ng-collapsible';
  • Add to the module import sections: imports: [ BrowserModule, NgCollapsibleModule]
  • Add the attribute ngCollapsible to your element:
    <div ngCollapsible>
        <h4>Simple Collapsible: </h4>
        <li *ngFor="let item of items">{{item}}</li>
    </div>

    Note: ngCollapsible will use the first element as a clickable header and the other as the collapsible items.

Component Inputs

isOpen

Use [isOpen] to programmatically close or open the collapse items:

<div ngCollapsible [isOpen]="true">
    <h4>Start Open Collapsible:</h4>
    <div *ngFor="let item of items">{{item}}</div>
</div>

ngCollapseOptions

Pass an object of type NgCollapsibleOptions to [ngCollapseOptions] in order to customize some behavior:

interface NgCollapsibleOptions {
    showArrow?: boolean;
    arrowSide?: NgCollapsibleArrowSide;
    accessibility?: boolean;
    iconSet?: NgCollapsibleIconSet;
    accordion?: boolean;
}

Options

  • showArrow: boolean - choose if to add an icon to the header. default true
  • arrowSide: NgCollapsibleArrowSide - choose the side of the icon. default start
  • accessibility: boolean - choose to add an accessibility attributes to the clickable header and the collapse items. default true
  • iconSet: NgCollapsibleIconSet - choose an icon set. default ionic
  • accordion: boolean - declare the element as a part of accordion, to close it when other accordion element will open. default false

Helpers

You have few interfaces and enums to help you fill NgCollapsibleOptions, all importable:

export enum NgCollapsibleArrowSide {
    start = 'start',
    end = 'end'
}

export enum NgCollapsibleIconSet {
    ionic = 'ionic',
    md = 'md',
    plusMinus = 'plus-minus'
}

Style

For compatibility the encapsulation of the component sets to ViewEncapsulation.None This way you can apply any style to any element even from your global css file. The component uses few css classes, you can override them and set your own style:

.ngCollapseHeaderBox, .ngCollapseHeader, .ngCollapseIcon, .ngCollapseItems

To change the style of the icon change .ngCollapseIcon svg style.

Compatibility

Tested with Angular 8 and Ionic 3 with Angular 5.

License

MIT