# Using toastr with webpack and TS

**URL:** https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947
**Category:** Framework Knowledge
**Created:** [November 24, 2018, 11:32am UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947 "2018-11-24T11:32:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jeremyholt](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jeremyholt/32/1098_2.png) [@jeremyholt](https://discourse.aurelia.io/u/jeremyholt)
#### Post date: [November 24, 2018, 11:32am UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/1 "2018-11-24T11:32:45Z")

</div>

After much messing around …

`yarn add toastr`  
`yard add @types/toastr`

`viewmodel.ts`

```auto
import * as toastr from "toastr"
import "../../../node_modules/toastr/build/toastr.min.css";

public bind(){
   toastr.options.closeButton = true // etc
}
 // statusMessage just holds the status and message you wish to display
public setNotification() {
    switch (this.statusMessage.status) {
      case StatusType.error:
        toastr.error(this.statusMessage.message);
        break;
      case StatusType.info:
        toastr.info(this.statusMessage.message);
        break;
      case StatusType.ok:
        toastr.success(this.statusMessage.message);
        break;
      default:
        toastr.clear();
    }
  }

```

`viewmodel.html`

```auto
  <div if.bind="statusMessage.show">
    ${setNotification()}
  </div>

```

Hope it helps someone

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [November 24, 2018, 1:25pm UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/2 "2018-11-24T13:25:21Z")

</div>

Might help me. i need to work with some sort of toast system. Thanks!

---

<div class="post-metadata">

### Author: ![jeremyholt](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/jeremyholt/32/1098_2.png) [@jeremyholt](https://discourse.aurelia.io/u/jeremyholt)
#### Post date: [November 24, 2018, 1:55pm UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/3 "2018-11-24T13:55:24Z")

</div>

Woops - forgot to add the css - edited the original

---

<div class="post-metadata">

### Author: ![brandonseydel](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/brandonseydel/32/993_2.png) [@brandonseydel](https://discourse.aurelia.io/u/brandonseydel)
#### Post date: [November 24, 2018, 8:52pm UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/4 "2018-11-24T20:52:37Z")

</div>

izitoast infinitely better btw

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [November 25, 2018, 12:12pm UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/5 "2018-11-25T12:12:46Z")

</div>

> [@brandonseydel](#):
>
> izitoast

you might be right, I’ll have to experiment with that. The demo looks good.

---

<div class="post-metadata">

### Author: ![ArchEnemy](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/archenemy/32/2445_2.png) [@ArchEnemy](https://discourse.aurelia.io/u/ArchEnemy)
#### Post date: [November 27, 2018, 6:32am UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/6 "2018-11-27T06:32:24Z")

</div>

If you use Aurelia-materialize-bridge, you can just inject MdToastService and toast.show(“done”); It’s very easy if you’re okay with installing more than you need just for a toast.

---

<div class="post-metadata">

### Author: ![roddharris](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/roddharris/32/1340_2.png) [@roddharris](https://discourse.aurelia.io/u/roddharris)
#### Post date: [May 19, 2020, 2:28pm UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/7 "2020-05-19T14:28:50Z")

</div>

Do you have an example of how to get started with izitoast? I did the `npm install` but I’m not sure how to pull in the associated .css. Do you just add it to the `index.ejs` file or are you downloading it and including it in your static resources?

---

<div class="post-metadata">

### Author: ![elitemike](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitemike/32/690_2.png) [@elitemike](https://discourse.aurelia.io/u/elitemike)
#### Post date: [May 19, 2020, 5:54pm UTC](https://discourse.aurelia.io/t/using-toastr-with-webpack-and-ts/1947/8 "2020-05-19T17:54:56Z")

</div>

I ended up just including it on my always loaded app html.
