Avner Moshkovitz
Avner Moshkovitz

Reputation: 1374

How to raise multiple toasts using bootstrap 4

I want to raise multiple toasts where the number of toasts are not known in advance.

The examples I see, have the html sections hardcoded in advance. For example [here][1] the html code for the 2 notifications is hard-coded. I can inject html code from within Javascript but I find it cumbersome to have to handle all that myself.

I found another library toastr where you can add more toast messages simply by calling from within javascript

toastr.success('Success messages');
toastr.error('errors messages');

I'm trying to avoid adding other libraries, as I am already using Bootstrap, and I want to keep the payload small.

Can I set dynamic number of Toasts using Bootstrap 4, e.g. similar to the toastr library?

Thanks,
Avi

Upvotes: 0

Views: 1399

Answers (1)

Avner Moshkovitz
Avner Moshkovitz

Reputation: 1374

I ended up using toastr. The payload is ~10KB for the minified version (toastr.min.css toastr.min.js)

Upvotes: 1

Related Questions