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

@hm-app/ngx-toast

v20.0.1

Published

`ngx-toast` is a lightweight and customizable Angular standalone component for displaying non-intrusive toast notifications in your application. It allows you to show messages like success, error, info, or warning notifications without blocking the user’s

Readme

ngx-toast (Standalone Angular Component)

ngx-toast is a lightweight and customizable Angular standalone component for displaying non-intrusive toast notifications in your application. It allows you to show messages like success, error, info, or warning notifications without blocking the user’s interaction with the app.

Features

  • Easy to use and configure
  • Customizable appearance (position, duration, type, etc.)
  • Standalone component (no need to modify AppModule)
  • Supports success, error, info, and warning messages
  • Lightweight and fast

Angular Version Compatibility

| Angular Version | Package Version | |----------------|-----------------| | 16.x.x | 1.x.x | | 17.x.x | 2.x.x | | 20.x.x | 3.x.x |

Installation

To install ngx-toast in your Angular project, use the following command:

npm install @hm-app/ngx-toast --save

Usage

1. Import the Standalone Component

After installation, you can directly use the NgxToastModule in your Angular components without needing to modify your AppModule.

import { NgxToastComponent } from '@hm-app/ngx-toast';
import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [NgxToastModule],
  template: `
        <ngx-toast />
  `,
  styleUrls: ['./app.component.css'],
})
export class AppComponent {
  // Your component logic here
}

2. Show Toast Notifications

In your component, inject the NgxToastComponent to show toast messages.

import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule],
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
})
export class YourComponent {
  constructor(private toastService: NgxToastService) {}

  showSuccessToast() {
    this.toastService.success('Add', 'Operation successful!', { 
      duration: 3000, // Duration in milliseconds
    });
  }

  showErrorToast() {
    this.toastService.error('Add', 'An error occurred!', { 
      duration: 3000 
    });
  }
}

3. HTML Template Example

Add buttons or other elements in the HTML template to trigger the toasts:

<button (click)="showSuccessToast()">Show Success Toast</button>
<button (click)="showErrorToast()">Show Error Toast</button>

Customization

You can customize the appearance of the toast notifications by modifying CSS variables. Add these variables to your global styles or component styles:

@layer ngx-toast {
  :root {
    /* Font Families */
    --ngx-toast-semibold-font-family: 'Inter', system-ui, sans-serif;
    --ngx-toast-bold-font-family: 'Inter', system-ui, sans-serif;
    --ngx-toast-normal-font-family: 'Inter', system-ui, sans-serif;

    /* Success Colors */
    --ngx-toast-confirm-color: #22c55e;
    --ngx-toast-confirm-bg-color: rgba(34, 197, 94, 0.1);

    /* Error Colors */
    --ngx-toast-error-color: #ef4444;
    --ngx-toast-error-bg-color: rgba(239, 68, 68, 0.1);

    /* Warning Colors */
    --ngx-toast-warning-color: #f59e0b;
    --ngx-toast-warning-bg-color: rgba(245, 158, 11, 0.1);

    /* Info Colors */
    --ngx-toast-info-color: #3b82f6;
    --ngx-toast-info-bg-color: rgba(59, 130, 246, 0.1);

    /* Action Button Colors */
    --ngx-toast-action-color: #3b82f6;
    --ngx-toast-action-hover-color: #2563eb;
    --ngx-toast-action-focus-color: #60a5fa;
    --ngx-toast-action-outline-color: #93c5fd;
  }
}

Available CSS Variables

| Variable | Description | Default Value | |----------|-------------|---------------| | Font Families | | --ngx-toast-semibold-font-family | Font family for semi-bold text | 'Inter', system-ui, sans-serif | | --ngx-toast-bold-font-family | Font family for bold text | 'Inter', system-ui, sans-serif | | --ngx-toast-normal-font-family | Font family for normal text | 'Inter', system-ui, sans-serif | | Success Colors | | --ngx-toast-confirm-color | Color for success messages | #22c55e | | --ngx-toast-confirm-bg-color | Background color for success toasts | rgba(34, 197, 94, 0.1) | | Error Colors | | --ngx-toast-error-color | Color for error messages | #ef4444 | | --ngx-toast-error-bg-color | Background color for error toasts | rgba(239, 68, 68, 0.1) | | Warning Colors | | --ngx-toast-warning-color | Color for warning messages | #f59e0b | | --ngx-toast-warning-bg-color | Background color for warning toasts | rgba(245, 158, 11, 0.1) | | Info Colors | | --ngx-toast-info-color | Color for info messages | #3b82f6 | | --ngx-toast-info-bg-color | Background color for info toasts | rgba(59, 130, 246, 0.1) | | Action Button Colors | | --ngx-toast-action-color | Main action button color | #3b82f6 | | --ngx-toast-action-hover-color | Action button hover color | #2563eb | | --ngx-toast-action-focus-color | Action button focus color | #60a5fa | | --ngx-toast-action-outline-color | Action button focus outline color | #93c5fd |

License

@hm-app/ngx-toast is released under the MIT License.