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

better-toast

v0.0.4

Published

Elegant toast notifications for Angular v21+ with stacked messages, variants, swipe-to-dismiss, entry and exit animations and a small service API.

Readme

Better Toast

Better Toast is a toast notification library for Angular v21+: stacked messages, variants, swipe-to-dismiss, entry and exit animations, accessibility-friendly live region, and a small ToasterService API.

Requirements: Angular ^21.0.0 (@angular/core, @angular/common).

Documentation

You can find the full documentation on the Better Toast website.

Install

npm install better-toast

Usage

Place a single <better-toaster> near the root of your app (for example in the root component) so the stack can render.

import { Component } from '@angular/core';
import { BetterToaster } from 'better-toast';

@Component({
  selector: 'app-root',
  imports: [BetterToaster],
  template: `<better-toaster />`,
})
export class App {}

Common inputs (all optional except using defaults):

| Input | Description | | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | duration | Default auto-dismiss in ms for toasts that omit durationMs (also supports the literal duration="Infinity" for manual dismiss). | | position | top-left | top-center | top-right | bottom-left | bottom-center | bottom-right (default bottom-right). | | richColors | When true, semantic background/border colors for success/error/info/warning. | | theme | light | dark | system (default). | | closeButton | Show per-toast dismiss control (default true). | | offset / mobileOffset | Viewport inset for the stack (string or per-side object). |

Styles ship with the components; you do not need to import a separate CSS file for the default look.

Show toasts from anywhere

Inject ToasterService and call the helpers. Each method returns a toast id you can pass to dismiss(id).

import { Component, inject } from '@angular/core';
import { ToasterService } from 'better-toast';

@Component({
  selector: 'app-example',
  template: `<button type="button" (click)="notify()">Save</button>`,
})
export class ExampleComponent {
  private readonly toaster = inject(ToasterService);

  notify(): void {
    this.toaster.success('Saved successfully');
  }
}

Variants and helpers

  • Text: show, description, success, error, info, warning, loading
  • Actions: action(message, { action: { label, onClick } }), cancel(message, { cancel: { label, onClick } })
  • Custom UI: custom(Component, options) (message area as a component), headless(Component, options) (full custom body, minimal chrome)
  • Async: promise(userPromise, { loading, success, error }) — one toast goes from loading → success/error
  • Control: dismiss(id), clear()

Example with options:

this.toaster.error('Something went wrong', {
  description: 'Try again in a few minutes.',
  durationMs: 6000,
});

const id = this.toaster.loading('Working…');
// later:
this.toaster.dismiss(id);

Constants re-exported for typing and defaults include DEFAULT_TOAST_DURATION_MS, TOAST_DURATION_MANUAL_DISMISS, TOAST_VARIANTS, TOASTER_POSITIONS, and default ARIA label helpers.

API surface

Everything is exported from the package entry point better-toast:

  • Component: BetterToaster (selector better-toaster)
  • Service: ToasterService
  • Types: ToastOptions, ToastVariant, ToasterPosition, and the other types listed in the package’s public-api.ts

For full behavior (icons, headless mode, class names, accessibility labels), see the source and TSDoc under projects/better-toast/src.