ng-kzsidenav
An Angular sidenav component
Installation
npm install --save ng-kzsidenav
Usage
Import KZSidenavModule
into your App module:
...;
Add ng-kzsidenav.css
into your angular.json
..."styles": ,...
In your component's html, simply use <kzsidenav>
wrapper and place your sidenav content within it. Your page content should be placed within a div having id kzmain
. Inorder to use functions of sidenav like toggeling the open/close functionality add a reference to kzsidenav
inside <kzsidenav>
.
Functions
The kzsidenav has a few public functions:
Function | Description |
---|---|
open() |
Opens the sidenav. |
close() |
Closes the sidenav. |
toggle() |
toggles the sidenav. |
currentState() |
Returns the current state of sidenav. |
Options
Inputs
The kzsidenav has a few input properties:
Property name | Type | Default | Description |
---|---|---|---|
mode | overlay , push , push-with-opacity , full |
push |
See the "Modes" section. |
position | left , right |
left |
What side the sidenav should be docked to. |
state | open ,close |
open |
At what state the sidenav should be initialized when the page loads. |
openSize | number | 250px |
Specify open width of sidenav with valid css dimension. |
closeSize | number | 0 |
Specify close width of sidenav with valid css dimension. |
hoverAnimation | Whether to animate the sidenav on mouse enter and mouse leave when sidenav is closed. |
Modes
overlay
The side navigation slides in over the page content.
push
This is the default mode. The page content is pushed to make space for the side navigation.
push-with-opacity
The page content is pushed to make space for the side navigation with black background and opacity to highlight side navigation.
full
The side navigation slides and covers the whole page (100% width):