Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.62 KB

how-to-show-notification.md

File metadata and controls

33 lines (24 loc) · 1.62 KB

SCION Workbench

SCION Workbench Projects Overview Changelog Contributing Sponsoring

A notification is a closable message that appears in the upper-right corner and disappears automatically after a few seconds. It informs the user of a system event, e.g., that a task has been completed or an error has occurred. Multiple notifications are stacked vertically. Notifications can be grouped. For each group, only the last notification is displayed.

How to show a notification

To show a notification, inject NotificationService and invoke the notify method, passing a Notification options object to control the appearance of the notification, like its severity, its content and show duration.

import {inject} from '@angular/core';
import {NotificationService} from '@scion/workbench';

const notificationService = inject(NotificationService);
notificationService.notify({
  content: 'Person successfully created',
  severity: 'info',
  duration: 'medium',
});

To display structured content, consider passing a component to NotificationConfig.content instead of plain text.