Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kevlatus/ngx-drawer-layout

Angular library for implementing a Material drawer layout.
https://github.com/kevlatus/ngx-drawer-layout

angular angular-material drawer drawer-layout layout material-design

Last synced: about 20 hours ago
JSON representation

Angular library for implementing a Material drawer layout.

Awesome Lists containing this project

README

        

![](https://img.shields.io/npm/v/ngx-drawer-layout.svg)
[![Build Status](https://github.com/kevlatus/ngx-drawer-layout/workflows/Test/badge.svg)](https://github.com/kevlatus/ngx-drawer-layout/actions)
[![Coverage Status](https://coveralls.io/repos/github/kevlatus/ngx-drawer-layout/badge.svg?branch=main)](https://coveralls.io/github/kevlatus/ngx-drawer-layout?branch=main)

# Angular Drawer Layout

This library provides [Angular](https://angular.io/) components for implementing a
[Material Design Drawer](https://material.io/design/components/navigation-drawer.html).
It relies on the [Angular Material Library](https://material.angular.io/).

Check out [this demo](https://kevlatus.github.io/ngx-drawer-layout/) to see it in action.

## Installing

Before installing, make sure to add Angular Material to your project. When using Angular CLI, you can run:

```
ng add @angular/material
```

For alternative installation refer to the [quick start guide](https://material.angular.io/guide/getting-started).

Using npm, you can install the library with:

```
npm install --save ngx-drawer-layout
```

### Enabling Material theming

If you want to benefit from Material theming, you need to use Angular Material
with [a custom theme](https://material.angular.io/guide/theming#defining-a-custom-theme).
Then, you can add theming to the drawer layout like this:

```scss
@import '~@angular/material/theming';
@import '~ngx-drawer-layout/theming'; // <-- include SASS lib file

@include mat-core();

$primary: mat-palette($mat-indigo);
$accent: mat-palette($mat-pink, A200, A100, A400);
$warn: mat-palette($mat-red);
$theme: mat-light-theme($primary, $accent, $warn);

@include angular-material-theme($theme);
@include ngx-drawer-layout-theme($theme); // <-- include the drawer layout theme
```

## Usage

**1. Import the DrawerLayoutModule**

```javascript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { DrawerLayoutModule } from 'ngx-drawer-layout';

@NgModule({
imports: [
BrowserModule,
DrawerLayoutModule, // <-- import module
],
bootstrap: [AppComponent],
})
export class AppModule {}
```

**2. Use the DrawerLayoutComponent**

```html


Toggle

NGX Drawer Layout Demo


Drawer Content


App Content

```