✨ Small and Clean JavaScript Toast Notifications

Overview

GitHub issues GitHub forks GitHub stars

All Contributors

BuzzNotify

Small and Clean JavaScript Toast Notifications

New version introduces breaking changes!

Now the styles come separately and you will have to use a new import:

// >= 1.6.0
import { Notify } from '@reliutg/buzz-notify'
import '@reliutg/buzz-notify/dist/buzz-notify.css'

Now the data-attribute is used to define the notification container:

<div id="notify"></div> // <-- Before 2.5.0
<div data-notify></div> // <-- After 2.5.0

Features

Beautiful and easy to use 😊 Lightweight ❤️ Strongly typed

Demo

https://buzz-notify-docs.vercel.app

Install

npm install @reliutg/buzz-notify

CDN

<link rel="stylesheet" href="https://unpkg.com/@reliutg/buzz-notify/dist/buzz-notify.css" />
<script src="https://unpkg.com/@reliutg/buzz-notify"></script>

ES6 Modules

import { Notify } from '@reliutg/buzz-notify'
import '@reliutg/buzz-notify/dist/buzz-notify.css'

or

Skypack no npm install needed!

<script type="module">
  import { Notify } from 'https://cdn.skypack.dev/@reliutg/buzz-notify'
  import 'https://cdn.skypack.dev/@reliutg/buzz-notify/dist/buzz-notify.css'
</script>

How to use

In index.html:

<div data-notify></div>

Define global options for all notifications.

<div 
  data-notify
  data-notify-type="warning" 
  data-notify-position="bottom-center"
  data-notify-transition="bounce" 
  data-notify-duration="2000">
</div>

In index.js:

Notify({ title: 'My notification' })

Change the default notification type

Notify({ title: 'My notification', type: 'danger' })

Determine the timeout in milliseconds. Default: 3000ms. If the duration is a negative number, the notification will not be removed.

Notify({ title: 'My notification', duration: 5000 })

Using asynchronously

import { NotifyAsync } from 'https://cdn.skypack.dev/@reliutg/buzz-notify'
NotifyAsync({ title: 'My notification' }).then(() => {
  console.log('Notification closed')
})

Listen to the close event

const n1 = Notify({ title: 'My notification' })

n1.addEventListener('notifyclose', () => {
  console.log('Notification closed')
})

Change the position of the toast message. Can be ‘top-left’, ‘top-right’, ‘top-center’, ‘bottom-left’, ‘bottom-center’, or ‘bottom-right’. Default: ‘top-right’.

Notify({ title: 'My notification', position: 'bottom-center' })

Execute a callback function when the toast message is dismissed.

Notify({ title: 'My notification' }, () => {
  console.log('Notification closed')
})

Usage with Vue

Try live demo

Usage with React

Try live demo

Customization

Customize the styles

:root {
  --bzn-trans-cubic-bezier: cubic-bezier(0.215, 0.61, 0.455, 1);
  --bzn-trans-duration: 0.4s;
  --bzn-color-success: #155724;
  --bzn-background-color-success: #d4edda;
  --bzn-border-color-success: #c3e6cb;
  --bzn-color-danger: #721c24;
  --bzn-background-color-danger: #f8d7da;
  --bzn-border-color-danger: #f5c6cb;
  --bzn-color-warning: #856404;
  --bzn-background-color-warning: #fff3cd;
  --bzn-border-color-warning: #ffeeba;
}

Customize icons

// You can change all or just one type of icon
// inline svg and emojis are supported :)
const myIcons = {
  success: '🎉',
  danger: '💣',
  warning: '⚠️',
}

Notify({ title: 'My notification', type: 'success', config: { icons: myIcons } })

Options

Notify({
  /**
   * Title of the notification
   */
  title: string;
  /**
   * Sets the HTML markup contained within the notification.
   */
  html?: string;
  /**
   * Sets the type of the notification.
   * @defaultvalue "success"
   */
  type?: Type;
  /**
   * Sets the position of the notification.
   * @defaultvalue "top-right"
   */
  position?: Position;
  /**
   * Auto close notification. Set in ms (milliseconds). If the duration is a negative number, the notification will not be removed.
   * @defaultvalue 3000
   */
  duration?: number;
  /**
   * Sets the transition effect.
   * @defaultvalue "fade"
   */
  transition?: Transition;
  /**
   * Sets the configuration of the notification.
   */
  config?: {
    /**
     * Override the default icons.
     */
    icons: Icons;
  } | null;
});

Based on

https://github.com/euvl/vue-notification

Contributors

Thanks goes to these wonderful people (emoji key):


krau5

💻 🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

Comments
  • fix: eslint fixed and the project refactored according to its rules

    fix: eslint fixed and the project refactored according to its rules

    1. eslintrc error has been fixed
    2. package-lock added. You don’t need to read or understand this file - just check it into source control. When other people start using your code, the lock file will ensure that they get precisely the same dependencies as you have.
    3. Formatted your code according to the eslint.

    P.S. I think you should change your Position type. Instead of top right you can make a type as following:

    type Position = {
      vertical: 'top' | 'bottom';
      horizontal: 'left' | 'center' | 'right'
    }
    

    And it will be much easier to use + you'd avoid position.split(' ') Waiting for a reply:)

    opened by krau5 11
  • refactor: Notification update

    refactor: Notification update

    1. .gitignore update
    2. check-types script to avoid some type errors
    3. build.js refactored according to eslint config
    4. Notification Position typed using an object, instead of string literal
    5. All durations are using s instead of ms
    opened by krau5 9
  • buzz-notify tries to install git hooks

    buzz-notify tries to install git hooks

    Hello, every time I install my project which uses buzz-notify, the postinstall script runs. This seems to be some dev script, but my project uses buzz-notify as dependency and I don't want to develop it. It would be good to remove this script or only run it if you directly have this project installed.

    opened by qwerty287 1
  • buzz-notify styles

    buzz-notify styles

    Mb u should import buzz-notify styles directly into index.ts instead of giving a requirement for user to import styles inside his "root" file

    opened by krau5 1
  • TypeError: Illegal constructor

    TypeError: Illegal constructor

    Thanks for the excellent library!

    Could you modify it to work correctly on the Mozilla browser? At the moment when running this code: new CSSStyleSheet this error occurs: TypeError: Illegal constructor

    bug 
    opened by seriousidea 1
Releases(v2.5.0)
  • v2.5.0(Jul 16, 2022)

    Core Changes

    Now the data-attribute is used to define the notification container:

    <div id="notify"></div> // <-- Before 2.5.0
    <div data-notify></div> // <-- After 2.5.0
    

    Define global options for all notifications.

    <div 
      data-notify
      data-notify-type="warning" 
      data-notify-position="bottom-center"
      data-notify-transition="bounce" 
      data-notify-duration="2000">
    </div>
    

    Improvements

    Added info style for notifications

    Full Changelog: https://github.com/eliutdev/buzz-notify/compare/v2.4.5...v2.5.0

    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Oct 27, 2021)

  • v2.3.1(Oct 16, 2021)

  • v2.1.6(Oct 15, 2021)

    What's Changed

    • fix: eslint fixed and the project refactored according to its rules by @Krausso in https://github.com/eliutgon/buzz-notify/pull/16
    • docs: add Krausso as a contributor for code, maintenance by @allcontributors in https://github.com/eliutgon/buzz-notify/pull/17

    New Contributors

    • @Krausso made their first contribution in https://github.com/eliutgon/buzz-notify/pull/16
    • @allcontributors made their first contribution in https://github.com/eliutgon/buzz-notify/pull/17

    Full Changelog: https://github.com/eliutgon/buzz-notify/compare/v2.1.5...v2.1.6

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Oct 7, 2021)

  • v2.0.0(Oct 6, 2021)

  • v1.8.0(Oct 6, 2021)

  • v1.7.4(Oct 6, 2021)

  • v1.6.0(Oct 4, 2021)

    Improvements

    Three new transition animations.

    • fade
    • bounce
    • slide-blurred

    You can use it by adding the option transition

    Changes

    Now the styles come separately and you will have to use a new import:

    import Notify from '@reliutg/buzz-notify'
    import '@reliutg/buzz-notify/css/index.css'
    
    Source code(tar.gz)
    Source code(zip)
Owner
R. Eliut
Expert developer in nothing :)
R. Eliut
Personal project to a student schedule classes according his course level. Using GraphQL, Clean Code e Clean Architecture.

classes-scheduler-graphql This is a personal project for student scheduling, with classes according his course level. I intend to make just the backen

Giovanny Lucas 6 Jul 9, 2022
It's an alert library build with JavaScript. You can replace your traditional JavaScript alert, confirm and toast with the library.

asteroid-alert It's an alert library build with JavaScript. You can replace your traditional JavaScript alert, confirm with the library. It has also e

Khan Md Sagar 4 Mar 12, 2021
EggyJS is a Javascript micro Library for simple, lightweight toast popups focused on being dependency-less, lightweight, quick and efficient.

EggyJS EggyJS is a Javascript micro Library for simple, lightweight toast popups. The goal of this library was to create something that meets the foll

Sam 10 Jan 8, 2023
A simple, lightweight, clean and small library for creating guided product tours for your web app.

Tourguide.js Simple, lightweight library for creating guided tours for your web, apps and more. A tour guide is a person who provides assistance, info

Docsie.io 277 Dec 12, 2022
A vanilla JavaScript toast library

Vanilla Toasts (also refered to as vtoast) is a lightweight VanillaJS toast library. It does not require any framework to run. It is inspired from toa

Paper Development 4 Jan 18, 2022
A simple and light jquery library for toast notification!

What is notify message? Notify message it's a simple jquery library for create a simple and light push notification in your website! How does this wor

Ivan Persiani 3 Feb 23, 2022
A simple, jQuery free Snackbar (Toast) alert

js-snackbar What is a SnackBar? According to Material Design a Snackbar or Toast provides "brief messages about app processes at the bottom of the scr

Michael Mickelson 43 Jan 5, 2023
Vanilla JS toast notification.

Toasting Toasting - is a javascript library for notifications. There is no dependencies needed. Installing There is no npm or cdn is available yet. by

Tharith Phon 1 Jun 30, 2022
Jquery Plugin for Make easy Toast

Nice Toast JS nice and easy toast for jquery Requirements jQuery Installation NPM npm install nice-toast-js Yarn yarn add nice-toast-js CDN - jsDelivr

Hasan Ahani 4 Jul 26, 2022
A small javascript DOM manipulation library based on Jquery's syntax. Acts as a small utility library with the most common functions.

Quantdom JS Quantdom is a very small (about 600 bytes when ran through terser & gzipped) dom danipulation library that uuses a Jquery like syntax and

Sean McQuaid 7 Aug 16, 2022
✏️ A small jQuery extension to turn a static HTML table into an editable one. For quickly populating a small table with JSON data, letting the user modify it with validation, and then getting JSON data back out.

jquery-editable-table A small jQuery extension to turn an HTML table editable for fast data entry and validation Demo ?? https://jsfiddle.net/torrobin

Tor 7 Jul 31, 2022
A Javascript based web application for monitoring, analytics and notifications

JELLYWATCH Jellywatch is a javascript web application for monitoring*, analytics** and notifications** inspired by tautulli for Jellyfin/Emby Media Se

null 27 Dec 28, 2022
A javascript framework for developing pretty browser dialogs and notifications.

AlertifyJS AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications. AlertifyJS is an extreme makeover of alertify

Mohammad Younes 2k Jan 2, 2023
Fnon is a client-side JavaScript library for models, loading indicators, notifications, and alerts which makes your web projects much better.

???????? Fnon is the name of my late mother, It's an Arabic word which means Art, I created this library in honor of her name. Fnon is a client-side J

Adel N Al-Awdy 5 Sep 11, 2022
A dependency-free JavaScript library for creating discreet pop-up notifications.

Polipop A dependency-free JavaScript library for creating discreet pop-up notifications. Demo See demo at minitek.github.io/polipop/. Documentation Se

Minitek 8 Aug 15, 2022
A lightweight JavaScript library for creating snackbar & toaster notifications.

Notify.js Notify.js is a lightweight (2.3kb) utility library for creating snackbar and toaster notifications. Installation Download Notify.js via NPM:

Kyle Andrews 7 Feb 13, 2022
ToastmeJS is a very simple, flexible and light weigth plugin that shows Notifications and modal Dialogs on your website.

⚡ ToastmeJS ToastmeJS is a very simple, flexible and light weigth plugin that shows Notifications and modal Dialogs on your website. Customize positio

Alejandro Vivas 8 Jun 20, 2022
Project to manage multiple emails at once with lots of customization. You can send and receive emails. Desktop notifications can be modified.

Technologies Used React Redux Tailwind CSS Features Admin dashboard User settings and or user dashboard send emails recive emails Connections through

Multi Email 9 Dec 17, 2022
Subscribe to rss feeds from anywhere, receive notifications from anywhere.

INK RSS 管理订阅,接收通知 示例网页 · 示例群组 · 报告Bug 介绍 特点 项目背景 TODO 注意事项 部署 额外附赠 使用建议 调查 贡献 作者 协议 介绍 INK RSS 提供及时且多样的 rss 通知服务,借助现有的接口你可以在任意位置订阅,并使用任意方式接收通知,并且所有服务均

null 253 Dec 28, 2022