Skip to content

haojia321/flash-message-toast

Repository files navigation

flash-message-toast

Responsive and Material Design. A package to display flash message or toast message without any UI framework dependency!
Other flash message package usually depends on other UI framework like Bootstrap or Materialize. This could cause some conflict to your project. This package doesn't depend on any UI package or UI framework. So you don't need to worry about the conflict to your projects.

You can see demo from Location1 or Location2.

Usage

import { FlashMessage } from 'meteor/haojia321:flash-message-toast';   
FlashMessage.show({  
    align: 'bottomCenter',  
    text: 'Hello World!'  
});  

API

FlashMessage.show(options);

Argument: options Object

  • align String
    Optional. Define how you want to align your message container.
    Allowed value: 'topRight', 'topLeft', 'topCenter', 'bottomRight', 'bottomLeft' and 'bottomCenter'. Default is 'topCenter'.
  • autoHide Boolean
    Optional. Define if the message will disappear automatically.
    Allowed value: true and false. Default is true.
  • hideDelay Integer millisecond
    Optional. Delay time before flash message disappears.
    Default is 2000.
  • text String
    Optional. Content of your flash message.
    Default is 'Hello World'.
  • isHtml Boolean
    Optional. Text will render as html content if isHtml is set to true.
    Default is false.
  • type String
    Optional. Define the type of the flash message.
    Allowed value 'info', 'error', 'success' and 'warning'. Default is 'info'.
  • showCloseButton Boolean
    Optional. Flash message will display a close button if set to true.
    Default is false.
  • beforeShow function
    Optional. function will be called before flash message is displayed on the UI.
  • afterShow function
    Optional. function will be called after flash message is displayed on the UI.
  • beforeHide function
    Optional. function will be called before flash message is removed from the UI.
  • afterHide function
    Optional. function will be called after flash message is remove from the UI.

Returns id of the flash message dom element.

FlashMessage.hide(id, obj);

Argument: id String

  • id string Required. id of the flash message dom element.

Argument: obj Object

  • beforeHide function
    Optional. function will be called before flash message is removed from the UI.
  • afterHide function
    Optional. function will be called after flash message is remove from the UI.

About

A package to display flash message or toast message.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published