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

ngx-sticky-sidebar

v1.0.4

Published

Custom Angular sidebar component

Downloads

12

Readme

Sticky-Sidebar

NPM

Status

npm version NPM Unpacked Size NPM License NPM Downloads

DEMO

REPOSITORY

A Customizable Sidebar Angular Component

Installation

npm install --save ngx-sticky-sidebar

Usage

Add NgxStickySidebarModule to your project:

app module:

import { NgxStickySidebarModule } from 'ngx-sticky-sidebar';

@NgModule({
  declarations: [ AppComponent ],
  imports: [ BrowserModule, NgxStickySidebarModule ],
  bootstrap: [ AppComponent ],
})
class AppModule {}

or layout component:

import { NgxStickySidebarModule } from 'ngx-sticky-sidebar';

@Component({
  selector: 'app-layout',
  standalone: true,
  imports: [
    NgxStickySidebarModule
  ],
  template: '',
  styles: []
})
export class LayoutComponent {}

Add <ngx-sticky-sidebar> to your layout template:

<ngx-sticky-sidebar [items]="items" [backgroundColor]="backgroundColor" [color]="color">
    <div id="sidebar-header" style="text-align: center;">
        <span> Sticky Sidebar </span>
    </div>
    <div id="sidebar-content">
        <span>Page Content</span>
        <router-outlet></router-outlet>
    </div>
</ngx-sticky-sidebar>

Inputs

| Property | Type | Default | Description | |----------|------|---------|-------------| | items | StickySidebarItems[] | [] | Elements for sidebar list. | | backgroundColor | string | black | Sidebar background color. | | color | string | white | Sidebar font color. | | width | string | 220px | Sidebar width size. | | padding | string | 1rem | Sidebar padding. | | backdropColor | string | #00000054 | Backdrop color. | | transitionDelay | string | 0.5s | Time (in sec) for each transition. | | overWidth | number | 992 | If the screen width is equal to or less than that value, the sidebar should disappear.| | dropWidth | number | 992 | If the screen width is equal to or less than that value, the sidebar should appear. | | closeBtnSize | number | 15 | Close button size for small screen widths. | | autoRoute | boolean | true | (Items with children) Determine the default route when clicking on the item without specifying a child. |

State

Add NgxStickySidebarService where you want get or set sidebar state:

import { NgxStickySidebarService } from 'ngx-sticky-sidebar';

@Component({
  selector: 'app-layout',
  templateUrl: './layout.component.html',
  styleUrls: ['./layout.component.scss']
})
export class LayoutComponent {
    state: boolean;

    constructor( private sidebar: NgxStickySidebarService ) {
        this.sidebar.stateAsObs.subscribe((state: boolean) => {
            this.state = state;
        })
    }

    toogle(): void {
        this.sidebar.toggle();
    }

    set_value(value: boolean): void {
        this.sidebar.set_state = value;
    }
}

Items

Declare your sidebar items.

E.g:

items: StickySidebarItems[] = [
    {
      label: 'Home',
      route: '/',
      childs: []
    },
    {
      label: 'Apps',
      route: '/apps',
      collapse: true,
      iconClass: 'bi bi-window-plus', // <-- using Boostrap Icons
      childs: [
        {
          label: 'One',
          route: '/one'
        },
        {
          label: 'Two',
          route: '/two'
        }
      ]
    }
]

Properties

| Property | Type | Description | | -------- | ---- | ----------- | | label | string | Text of item to display on sidebar list | | route | string | Route to navigate upon clicking | | childs | { label: string, route: string }[] | Text and routes for item's children | | collapse | boolean | Default value for collapse item if have children | | iconClass | string | Class name for <i> element to display custom icon |