how to change the width of ngx-toastr in angular 9

4.4k views Asked by At

I have ngx-toastr message notification from npm. Is there a way to change the size of message container?

when I open my application in small device, then toastr notification is too big.

ToastrModule.forRoot({
      timeOut: 1000,
      positionClass: 'toast-top-right',
      preventDuplicates: true,
    }),
1

There are 1 answers

0
NeNaD On

If you want to change the size of toastr-dialog on all devices, add this to the styles.scss file:

.ngx-toastr {
  width: 250px !important;  // Specify toastr-dialog width for all devices
}

If you want to change the size only on small devices, you can use @media query to do it.

.ngx-toastr {
  @media (max-width: 768px) {
    width: 250px !important;  //  Specify toastr-dialog width only on small devices 
  }
}