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

fn-toast

v0.0.9

Published

Reusable Angular standalone component for toast notifications.

Downloads

678

Readme

FNToast

FNToast is a professional, standalone Angular library for displaying toast notifications. It features a centralized service for triggering multiple types of alerts with built-in support for translations, dynamic icons, and automatic dismissal.


🌟 Features

  • Standalone Component: No need for complex module registrations.
  • Multiple Notification Types: Success, Error, Warn, and Info.
  • Dynamic Icons: Powered by @arpudhabotupload/fn-icon-angular for consistent branding.
  • Auto-dismissal: Configurable duration with a default fallback.
  • Centralized Service: Trigger toasts from anywhere in your application.
  • i18n Ready: Built-in support for @ngx-translate/core.

📦 Installation

Install the library and its peer dependencies:

npm install fn-toast @arpudhabotupload/fn-icon-angular @ngx-translate/core rxjs

⚙️ Setup

1. Configure Providers

Ensure your application provides HttpClient and TranslateService.

import { provideHttpClient } from '@angular/common/http';
import { importProvidersFrom } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';

export const appConfig: ApplicationConfig = {
  providers: [provideHttpClient(), importProvidersFrom(TranslateModule.forRoot())],
};

2. Add Toast Container

Add the fn-toast component to your root application template (usually app.component.html).

<fn-toast></fn-toast> <router-outlet></router-outlet>
import { FNToast } from 'fn-toast';

@Component({
  standalone: true,
  imports: [FNToast, RouterOutlet],
  // ...
})
export class AppComponent {}

🚀 Usage

Inject the ToastService to trigger notifications from any component or service.

import { inject } from '@angular/core';
import { ToastService } from 'fn-toast';

export class MyComponent {
  private toastService = inject(ToastService);

  showSuccess() {
    this.toastService.success('Profile updated successfully!');
  }

  showError() {
    this.toastService.error('Failed to save changes.', 'Error');
  }
}

📄 API Reference

ToastService Methods

| Method | Parameters | Default Duration | Description | | :-------- | :----------------------------- | :--------------- | :------------------------------- | | success | (message, title?, duration?) | 3000ms | Triggers a success notification. | | error | (message, title?, duration?) | 5000ms | Triggers an error notification. | | warn | (message, title?, duration?) | 5000ms | Triggers a warning notification. | | info | (message, title?, duration?) | 5000ms | Triggers an info notification. | | remove | (id: string) | N/A | Removes a specific toast by ID. | | clear | () | N/A | Clears all active toasts. |

Toast Interface

export interface Toast {
  id: string;
  type: 'success' | 'error' | 'warn' | 'info';
  title?: string;
  message: string;
  duration?: number;
  isVisible?: boolean;
}

🎨 UI Customization

The component uses CSS variables for theming. You can override these in your global styles:

| Variable | Description | | :---------- | :----------------------------- | | --Base-90 | Background color of the toast. | | --Base-0 | Text and icon color. |

The container is positioned at the top-center by default:

.toast-container {
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
}