A toast notification library for Angular, built with focus on simplicity, accessibility, and zero external dependencies.
Built with focus on simplicity and code clarity.
Only Angular as peer dependency. No external libraries, no version conflicts, no surprises.
Built with Angular's Signals API. Reactive, performant state without unnecessary RxJS.
All timers are automatically cleaned up. No memory leaks, no side effects, no surprises.
ARIA live regions for screen readers. Respects reduced motion preferences automatically.
CSS variables for everything. Works with Tailwind, PrimeFlex, or pure CSS. You decide the look.
Written to be understood by any developer. No tricks, no magic, no abbreviations.
Click the buttons below to see toasts in action.
Escolha um tipo para visualizar
Experimente diferentes configurações
Simple installation, intuitive usage.
Run this command in your terminal, inside your Angular project:
npm install toastly
package.json.
The container is where toasts appear. Add it to your main component:
import { Component } from '@angular/core';
import { ToastContainerComponent } from 'ng-toastly';
@Component({
selector: 'app-root',
imports: [ToastContainerComponent],
template: `
<router-outlet />
`<!-- Add this line -->
<toastly-container />
`,
})
export class AppComponent {}
Use the ToastService in any component to show notifications:
import { inject } from '@angular/core';
import { ToastService } from 'ng-toastly';
export class MeuComponente {
// Inject the toast service
private readonly toastService = inject(ToastService);
salvarDados(): void {
// Show a success toast!
this.toastService.success('Data saved successfully!');
}
}
The full documentation has examples, customizations, and best practices.
View Full Documentation
Yes! The library is compiled with compilationMode: "partial", which
allows it to work on any Angular version between 17 and 21. You don't need to
worry about compatibility.
No! Toastly has zero external dependencies. Only Angular as peer dependency. This means fewer conflicts, smaller builds and easier maintenance.
Yes! You can pass custom CSS classes through the
styleClass parameter. Works with Tailwind, PrimeFlex, Bootstrap or any
CSS framework.
Yes! All auto-dismiss timers are stored in a Map and cleaned up automatically when the toast is removed or when the service is destroyed. This prevents memory leaks.
Yes! The container uses aria-live="polite" to announce new toasts to
screen readers. Warning and danger toasts use role="alert". Animations
are automatically disabled when the user has
prefers-reduced-motion enabled.