1.1.6 • Published 1 year ago

mat-snackbar-severity v1.1.6

Weekly downloads
134
License
-
Repository
github
Last release
1 year ago

MatSnackbarSeverity

Angular Library that adds severity (inspired by bootstrap alerts) to Material Design's mat-snack-bar.

This Angular library is a functional extension of the mat-snack-bar component since it only applies its own design (but respecting the material design guideline) encapsulating the applied customization. Being an extension it supports all the native functionality of mat-snack-bar.

Examples

This bookstore has two appearances

  • filled
  • outlined

Filled in the light theme:

Filled in the dark theme:

Outlined in the light theme:

Outlined in the dark theme:

Outlined Dark in the light theme:

Install

/* Be sure to import the material modules */
npm i @angular/cdk@currentVersion
npm i @angular/material@currentVersion

/* Import library */
npm i mat-snackbar-severity

Examples code

Import into the module to use:

import { MatSnackbarSeverityModule } from 'mat-snackbar-severity';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...

    MatSnackbarSeverityModule
  ],
  bootstrap: [...]
})
export class AppModule { }

Defined scss in global styles:

/* Make sure you are importing the global mixin of material: */
@include angular-material-theme($candy-app-theme);

/* or in the case of using another theme then specify the following mixins: */
@include mat-snack-bar-theme($candy-app-theme);
@include mat-button-theme($candy-app-theme);

/* design filled */
@import '~mat-snackbar-severity/mat-snackbar-severity-filled';

/* design light outlined */
@import '~mat-snackbar-severity/mat-snackbar-severity-outlined';

/* design dark outlined */
$severity-is-dark-theme: true;
@import '~mat-snackbar-severity/mat-snackbar-severity-outlined';

Use:

import { Component, OnInit } from '@angular/core';
import { MatSnackbarSeverity, SnackbarSeverity } from 'mat-snackbar-severity';

@Component({
  ...
})
export class AppComponent implements OnInit {

  constructor(
    ...
    private snackBarSeverity: MatSnackbarSeverity
  ) { }

  openSnackbarSeverity() {

    const severity: SnackbarSeverity = 'success';

    this.snackBarSeverity.open(severity, 'Success Message', 'Ok', {
        verticalPosition: 'top',
        horizontalPosition: 'right'
      });

    // this.snackBarSeverity.open('error', 'Error Message', 'Ok');
    // this.snackBarSeverity.open('warning', 'Warning Message', 'Ok');
    // this.snackBarSeverity.open('info', 'Info Message', 'Ok');
  }

}

Options severity

export declare type SnackbarSeverity = 'error' | 'warning' | 'info' | 'success';
1.1.1

1 year ago

1.0.19

1 year ago

1.1.0

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.16

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago