Ember CLI Notifications

9.1.0 · active · verified Wed Apr 22

Ember CLI Notifications is an Ember addon that provides Atom-inspired, transient notification messages for Ember applications. It enables developers to display various types of in-app alerts such as success, error, warning, and info messages, typically appearing at the top of the screen. The current stable version is 9.1.0, released in January 2025. This package generally follows a release cadence tied to Ember.js and Ember CLI updates, with major versions often introducing breaking changes to keep pace with the evolving Ember ecosystem, typically every 1-2 years. Key differentiators include its focus on a simple, injectable service for managing notifications, allowing programmatic control over message display, and offering customizable styling options. It integrates seamlessly into modern Ember applications, supporting Embroider and ember-auto-import v2.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to inject the `notifications` service into an Ember controller and use it to display various types of notifications (success, error, info) with custom options, as well as clearing them.

import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';

export default class ApplicationController extends Controller {
  @service notifications;

  @action
  showSuccessNotification() {
    this.notifications.success('Operation successful!', {
      autoClear: true,
      clearDuration: 3000,
      cssClasses: 'custom-success-class',
      htmlContent: '<b>Successfully</b> completed action.'
    });
  }

  @action
  showErrorNotification() {
    this.notifications.error('Something went wrong.', {
      autoClear: false,
      cssClasses: 'custom-error-class'
    });
  }

  @action
  showPersistentInfo() {
    this.notifications.info('This is an informational message.', {
      autoClear: false,
      clearDuration: 0 // Will stay until manually cleared
    });
  }

  @action
  clearAllNotifications() {
    this.notifications.clearAll();
  }
}

view raw JSON →