Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom notification types #23

Closed
snipervld opened this issue Jul 13, 2018 · 1 comment
Closed

Custom notification types #23

snipervld opened this issue Jul 13, 2018 · 1 comment

Comments

@snipervld
Copy link

snipervld commented Jul 13, 2018

Hi, thanks for such a great library.

For now, there are only two types of notification: alert and confirm with notyf--alert and notyf--confirm css classes respectively.
It would be better, if there was a way to add another type of notification or css class. For example, type warning (with another class).

Example API:

const notyf = new Notyf();

notyf.custom('We had some trouble', { className : 'warning' });

Or based on issue #22:

const notyf = new Notyf({
  types: {
    warning: {
      delay: 1000, // #7
      duration: 2000, // #6
      icon: 'fa-foo-fi-fu',
      notificationClass: 'notyf--warning',
    },
  },
});

const errorNotification = notyf.custom({
  type: 'warning'
  title: 'Some uncritical issue',
  message: 'We had some trouble',
});
@caroso1222
Copy link
Owner

Thanks for this idea! v3.0.0 has been released with full support for registering new types as requested. Here's how to do it:

const notyf = new Notyf({
  types: [
    {
      type: 'info',
      backgroundColor: 'blue',
      icon: false
    }
  ]
})

notyf.open({ type: 'info', message: 'Do not forget to pause the timer' });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants