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

aurelia2-notification

v1.0.0

Published

Aurelia 2 notification library

Readme

aurelia2-notification

An Aurelia 2 notification/toast library with no third‑party runtime dependencies. Fully configurable, accessible defaults, optional i18n adapter, and a host component you can drop into any app.

Features

  • Positions (top/bottom + left/center/right)
  • Stacking order control
  • Max visible per position + overflow policy (queue/discard)
  • Auto‑dismiss with duration + pause on hover/focus
  • Dismiss actions, click‑to‑dismiss, and close button
  • Progress indicator
  • Typed API + update/ref control
  • Optional i18n adapter (@aurelia/i18n)
  • Styling via CSS variables + class hooks

Install

npm i aurelia2-notification

Basic setup

import { Aurelia } from 'aurelia';
import { AureliaNotificationConfiguration } from 'aurelia2-notification';

Aurelia.register(
  AureliaNotificationConfiguration.configure({
    defaults: {
      position: 'top-right',
      duration: 4000,
      showProgress: true,
    },
    maxItems: 4,
    newestOnTop: true,
  })
);

Add the host somewhere in your root component template (typically app.html):

<au-notification-host></au-notification-host>

Then inject and use the service:

import { resolve } from '@aurelia/kernel';
import { INotificationService } from 'aurelia2-notification';

const notifications = resolve(INotificationService);
notifications.success('Saved!');
notifications.error('Something went wrong', { duration: 8000 });

Optional i18n

The plugin does not force @aurelia/i18n. If you want translations, register the adapter:

import { AureliaNotificationConfiguration, NotificationI18nConfiguration } from 'aurelia2-notification';

Aurelia.register(
  AureliaNotificationConfiguration,
  NotificationI18nConfiguration
);

Then pass translation descriptors:

notifications.notify({
  message: { key: 'toast.saved', params: { name: 'Profile' } },
  type: 'success',
});

API

interface INotificationService {
  notify(message: NotificationMessage, options?: NotificationOptions): NotificationRef;
  notify(options: NotificationOptions & { message: NotificationMessage }): NotificationRef;
  success(message: NotificationMessage, options?: NotificationOptions): NotificationRef;
  error(message: NotificationMessage, options?: NotificationOptions): NotificationRef;
  info(message: NotificationMessage, options?: NotificationOptions): NotificationRef;
  warning(message: NotificationMessage, options?: NotificationOptions): NotificationRef;
  note(message: NotificationMessage, options?: NotificationOptions): NotificationRef;
  dismiss(id: string, reason?: NotificationCloseReason): void;
  clear(reason?: NotificationCloseReason): void;
  update(id: string, patch: NotificationOptions): void;
  pause(id: string): void;
  resume(id: string): void;
}

NotificationOptions

type NotificationMessage =
  | string
  | string[]
  | { key: string; params?: Record<string, unknown>; defaultValue?: string | string[] };

interface NotificationAction {
  id?: string;
  label: NotificationMessage;
  ariaLabel?: NotificationMessage;
  class?: string;
  dismiss?: boolean;
  callback?: (notification, action) => void | Promise<void>;
}

interface NotificationOptions {
  id?: string;
  type?: 'note' | 'success' | 'error' | 'info' | 'warning';
  position?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
  message?: NotificationMessage;
  title?: NotificationMessage;
  allowHtml?: boolean;
  icon?: string;
  class?: string | string[];
  style?: string;
  data?: unknown;
  duration?: number;
  autoDismiss?: boolean;
  dismissible?: boolean;
  closeOnClick?: boolean;
  showCloseButton?: boolean;
  closeButtonLabel?: NotificationMessage;
  pauseOnHover?: boolean;
  pauseOnFocus?: boolean;
  showProgress?: boolean;
  actions?: NotificationAction[];
  ariaLive?: 'polite' | 'assertive' | 'off';
  role?: 'status' | 'alert';
  onOpen?: (item) => void;
  onClose?: (item, reason) => void;
  onClick?: (item, event) => void;
  dedupe?: boolean;
}

NotificationRef

interface NotificationRef {
  id: string;
  dismiss(reason?: NotificationCloseReason): void;
  update(patch: NotificationOptions): void;
  pause(): void;
  resume(): void;
}

Global configuration

AureliaNotificationConfiguration.configure({
  defaults: {
    duration: 4500,
    autoDismiss: true,
    dismissible: true,
    closeOnClick: false,
    pauseOnHover: true,
    pauseOnFocus: true,
    showProgress: true,
    showCloseButton: true,
    closeButtonLabel: 'Close notification',
  },
  types: {
    error: { role: 'alert', ariaLive: 'assertive' },
    warning: { role: 'alert', ariaLive: 'assertive' },
  },
  maxItems: 5,
  newestOnTop: true,
  overflow: 'discard-oldest', // or 'discard-newest' | 'queue'
  maxQueue: 50,
  dedupe: false,
  animations: { enter: 160, exit: 200 },
});

Multiple hosts / positions

You can render a single host (shows all positions) or multiple hosts for specific positions:

<au-notification-host position="top-right"></au-notification-host>
<au-notification-host position="bottom-left"></au-notification-host>

Styling

The host ships with a polished default theme that you can override with CSS variables:

au-notification-host {
  --au-notification-bg: #0b1320;
  --au-notification-fg: #f8fafc;
  --au-notification-muted: #cbd5f5;
  --au-notification-radius: 12px;
  --au-notification-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
  --au-notification-success-bg: #0f766e;
  --au-notification-success-accent: #5eead4;
  --au-notification-error-bg: #b91c1c;
  --au-notification-error-accent: #fca5a5;
}

There is also a built-in light theme you can enable with a class or attribute:

<au-notification-host class="au-notification-host--light"></au-notification-host>
<au-notification-host data-theme="light"></au-notification-host>

You can also add classes via config:

AureliaNotificationConfiguration.configure({
  classes: {
    host: 'my-host',
    item: 'my-toast',
    action: 'my-action',
  }
});