Import
import { NuiToaster, NuiToasterRegion } from '@needless-ui/angular/toast';NuiToaster
The service that shows toasts. Inject it anywhere.
| Name | Type | Default | Description |
|---|---|---|---|
toastsMethod | Signal<readonly NuiToast[]> | Every toast on screen, newest first. | |
showMethod | (options: NuiToastOptions | string) => NuiToastRef | Shows a toast. Pass a title, or options with a description, tone, duration, action or id. | |
successMethod | (title, options?) => NuiToastRef | Shows a success toast. | |
warningMethod | (title, options?) => NuiToastRef | Shows a warning toast. | |
dangerMethod | (title, options?) => NuiToastRef | Shows a danger toast. It stays 8 seconds and is announced assertively. | |
promiseMethod | (promise, messages) => Promise | Shows a loading toast until the promise settles, then its success or danger message. | |
dismissMethod | (id?: string) => void | Dismisses one toast, or all of them. |
NuiToasterRegion
The region where toasts appear. Place it once, in the app shell.
| Name | Type | Default | Description |
|---|---|---|---|
positionInput | 'top-start' | 'top-center' | 'top-end' | 'bottom-start' | 'bottom-center' | 'bottom-end' | 'bottom-end' | Corner or edge of the viewport. Start and end follow the text direction. |
expandedInput | boolean | false | Keeps the stack fanned out. |
labelInput | string | 'Notifications (Alt+T)' | Accessible name of the region. Say how to reach it. |
closeLabelInput | string | 'Dismiss' | Accessible name of the close buttons. |
hotkeyInput | string | 'KeyT' | The key, as a KeyboardEvent.code, that moves focus to the newest toast with Alt. |