Mail: [email protected] Phone: +1(424)231-4091

nsSnackBar

The "nsSnackBar" is used to display messages on the front end. This usually displays to inform the user of information that might be required to perform an action. It's a better alert replacement because it doesn't hide or cover the workspace. Here is how the SnackBar looks like.

The nsSnackBar object is available from every dashboard page. It can even be used on the browser console for testing. Mainly, the Snack Bar can be used to display informative, successful, and error messages available on "info", "success" and "error" methods, which accept the text as first parameters, the call to action button label and some configuration provided as an object.

Create a success notification

Create an error notification

Here, we've used "OKAY" as a label for the call to action button. The snack bar will look like this.

Create an info notification

Here, we've configured the duration of the snack bar (expressed in microseconds).

If you would like a snack bar to last forever, you should make sure to always include a call to action button, and then you can set the duration to "0".

A call to action button can be disabled by defining the label to "null".