npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ngx-toastf

v2.1.0

Published

A lightweight, standalone-first toast notification library for Angular apps

Downloads

450

Readme

NgxToastf

CI Quality Gate Status Coverage

📖 Official Documentation

ngx-toastf is a lightweight, standalone-first toast notification library for Angular apps - no ViewContainerRef or template markup required, just inject a service and call it.

Features

  • ✅ Zero setup - NgxToastService works out of the box, no provider or module required
  • ✅ Standalone-first - provideNgxToast() for standalone apps; NgxToastModule for NgModule apps (deprecated)
  • ✅ CSS transitions - no @angular/animations dependency
  • ✅ Stacking - multiple toasts coexist and stack per position
  • ✅ 9 positions, 4 types (success/info/warning/error), configurable duration/auto-close/ animation timing
  • ✅ Signal-based component - input()/output(), OnPush, zero @Input/@Output decorators

Compatibility

Latest version available for each version of Angular:

| ngx-toastf | Angular | | ---------- | ------------ | | 2.0.0 | 20.x to 22.x | | 1.2.1 | 9.x 8.x 7.x |

Live Example

You can check how this library works in the following link, on a live example: ngx-toastf live demo

Installation

npm install ngx-toastf --save

Breaking change in 2.0: @angular/animations is no longer a dependency (replaced by CSS transitions), and the fontello icon font is gone (icons are now inline SVG) - drop both from your setup. See Migration below.

Setup

Standalone apps (Angular >= 14): no setup is required - NgxToastService is providedIn: 'root' with sensible defaults. Only add provideNgxToast() if you want to override the global defaults:

import { provideNgxToast, withToastConfig } from 'ngx-toastf'

bootstrapApplication(AppComponent, {
  providers: [
    provideNgxToast(withToastConfig({ closeButton: true })),
    // ...other providers
  ],
})

NgModule apps:

import { NgxToastModule } from 'ngx-toastf'

@NgModule({
  imports: [
    BrowserModule,
    NgxToastModule.forRoot(), // optional - pass a config object to override defaults
  ],
})
export class AppModule {}

Deprecated: NgxToastModule is kept for backward compatibility but will be removed in a future major version. Prefer provideNgxToast(), including in NgModule-based apps (it returns a plain Provider[] you can drop into your providers array).

Usage

import { Component, inject } from '@angular/core'
import { NgxToastService, NgxToastType } from 'ngx-toastf'

@Component({...})
export class YourComponent {
  private readonly toastService = inject(NgxToastService)

  showSuccess(): void {
    this.toastService.showToastSuccess('Hello world!', { title: 'Test!' })
  }

  showCustomType(): void {
    // Generic show() also available alongside the four typed methods
    this.toastService.show(NgxToastType.Info, 'Hello world!')
  }
}

Calling any showToastX()/show() again while a toast is visible stacks a new toast rather than replacing the existing one - multiple toasts (even in the same position) coexist.

Options

| Option | Type | Default | Description | | ----------------- | ------- | ---------- | --------------------------------------------- | | title | string | '' | Title for the toast message | | position | enum | TopRight | Toast stack position, see below | | duration | number | 3000 | Time to live in milliseconds (when autoClose) | | closeButton | boolean | false | Show a close button | | showIcon | boolean | true | Show the type icon | | tapDismiss | boolean | false | Close when the toast itself is clicked | | autoClose | boolean | true | Automatically close after duration | | animationDuration | number | 200 | Open/close CSS transition duration (ms) |

You can pass any of these per-call as the last argument to showToastX()/show(), or set global defaults once via provideNgxToast(withToastConfig({...})) / NgxToastModule.forRoot({...}).

Position values
enum NgxToastPosition {
  BottomCenter = 'bottom-center',
  BottomFullWidth = 'bottom-full-width',
  BottomLeft = 'bottom-left',
  BottomRight = 'bottom-right',
  TopCenter = 'top-center',
  TopFullWidth = 'top-full-width',
  TopLeft = 'top-left',
  TopRight = 'top-right',
  Center = 'center',
}

Styling

Each toast's host element gets a base ngx-toast class plus a type modifier (ngx-toast--success / -info / -warning / -error) and a state modifier (ngx-toast--opening / -open / -closing). Override the type classes to customize colors:

.ngx-toast--success {
  background-color: green !important;
}
.ngx-toast--error {
  background-color: pink !important;
}

Migration from 1.x

  • NgToastService/NgToastComponent/NgToastModule/NgToastConfig/NgToastPosition/ NgToastType are renamed to NgxToast*.
  • Drop @angular/animations and BrowserAnimationsModule - no longer needed.
  • Drop the fontello CSS import (ngx-toastf/src/assets/fontello/css/all.min.css) - icons are now inline SVG, bundled with the component.
  • NgToastConfig is now an interface (not a class) - replace new NgToastConfig({...}) with a plain object literal.
  • Showing a new toast no longer replaces an existing one - toasts now stack. If you relied on the old single-toast/duplicate-blocking behavior, close the previous toast explicitly first.

Test

ngx-toastf-showcase is the demo project. Use pnpm start to run it.

License

MIT


Github @darioegb