1.0.4 • Published 5 years ago

angular-ng-sidenav v1.0.4

Weekly downloads
78
License
MIT
Repository
github
Last release
5 years ago

Angular Sidenav

Table of contents

Features

  • Simple sidenav with hidden and collapsed view.
  • Variable properties and event bindings.
  • Custom template.

Getting started

Step 1: Install angular-ng-sidenav:

NPM

npm i angular-ng-sidenav

Step 2: Import the SidenavLibModule:

import {SidenavModule} from 'angular-ng-sidenav';

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

Usage sample

<ng-sidenav-container>
  <ng-sidenav
    [expanded]="isExpanded"
    [drawerState]="state"
    [drawerWidth]="'250px'"
    [drawerWidthCollapsed]="'80px'"
    [color]="'#202c2b'">
    Sidenav content
  </ng-sidenav>
  <ng-sidenav-content>
    Main content
  </ng-sidenav-content>
</ng-sidenav-container>
class TestComponent {
  isExpanded = true;
  state = 'collapsed';

  toggleSidenav() {
    this.isExpanded = !this.isExpanded;
  }
}

API

Inputs

InputTypeDefaultRequiredDescription
expandedbooleannullyesWhether drawer is open or close depend on drawer state.
drawerStatestringnullyesDrawer state (expanded, collapsed, hidden).
colorstring#19222anoSidenav color
drawerWidthstring250pxnoDrawer width by default.
drawerWidthCollapsedstring80pxnodrawer default width on collapsed view by default.
*hiddenOnCollapsedbooleanfalsenoshow/hide some elements inside sidenav when drawer state changes from or to collapsed.

Author

License

MIT