Skip to content
angulux
@anguless/angulux/toast

Toast

2 declarations3 demostoast.md
import
import { ToastModule } from '@anguless/angulux/toast';

Basic

Toast renders whatever MessageService is told to add. The service is provided by the component that owns the toast.

<agl-toast /><agl-button label="Show" (onClick)="show()" />

Severity

Severity decides the colour and icon of the message.

<agl-toast /><agl-button label="Success" severity="success" (onClick)="show('success', 'Success', 'Message sent')" /><agl-button label="Info" severity="info" (onClick)="show('info', 'Info', 'Message content')" /><agl-button label="Warn" severity="warn" (onClick)="show('warn', 'Warning', 'Check the form')" /><agl-button label="Error" severity="danger" (onClick)="show('error', 'Error', 'Something failed')" />

Position

Several toasts can coexist when each has its own key, and messages are routed by that key.

<agl-toast position="top-left" key="tl" /><agl-toast position="bottom-center" key="bc" /><agl-button label="Top left" (onClick)="show('tl')" /><agl-button label="Bottom center" (onClick)="show('bc')" />

API

Generated from the committed corpus, which check:corpus holds to the built library.

ToastItem

componentagl-toastItem
InputTypeDefaultDescription
messageToastMessageOptions | null | undefinednot documented
indexnumber | null | undefinednot documented
lifenumbernot documented
templateTemplateRef<ToastMessageTemplateContext> | undefinednot documented
headlessTemplateTemplateRef<ToastHeadlessTemplateContext> | undefinednot documented
showTransformOptionsstring | undefinednot documented
hideTransformOptionsstring | undefinednot documented
showTransitionOptionsstring | undefinednot documented
hideTransitionOptionsstring | undefinednot documented
motionOptionsMotionOptionsnot documented
clearAllanynot documented
OutputTypeDescription
onAnimationStartHTMLElement
onAnimationEndHTMLElement
onCloseEventEmitter<ToastItemCloseEvent>

Inherited from BaseComponent

inherited
InputTypeDefaultDescription
dtObject | undefined undefined Defines scoped design tokens of the component.
unstyledboolean | undefined undefined Indicates whether the component should be rendered without styles.
ptPT | undefined undefined Used to pass attributes to DOM elements inside the component. Keys become attributes, and a key that names a DOM property is also assigned to that property. Values the browser would execute go through Angular's sanitizer first, as in a template binding: markup in `innerHTML`, `outerHTML` and `srcdoc`, and URLs in `href`, `src`, `action`, `formaction` and `xlink:href`. To write one of those unsanitized on purpose, pass a `DomSanitizer.bypassSecurityTrustHtml` or `bypassSecurityTrustUrl` value. An `on*` key must be a function, and any other value for it is ignored. Keys themselves are applied as given, so let data from users choose values, never keys.
ptOptionsPassThroughOptions | undefined undefined Used to configure passthrough(pt) options of the component.

Toast

componentagl-toast

Toast is used to display messages in an overlay.

InputTypeDefaultDescription
keystring | undefinednot documentedKey of the message in case message is targeted to a specific toast component.
autoZIndexbooleannot documentedWhether to automatically manage layering.
baseZIndexnumbernot documentedBase zIndex value to use in layering.
lifenumbernot documentedThe default time to display messages for in milliseconds. The pointer over a message, or keyboard focus in it, pauses its timer; once both have left, the message gets its full time again.
styleClass
deprecated — since v20.0.0, use `class` instead.
string | undefinednot documentedInline class of the component.
positionToastPositionTypenot documentedPosition of the toast in viewport.
preventOpenDuplicatesbooleannot documentedIt does not add the new message if there is already a toast displayed with the same content
preventDuplicatesbooleannot documentedDisplays only once a message with the same content.
showTransformOptions
deprecated — since v21.0.0. Use `motionOptions` instead.
stringnot documentedTransform options of the show animation.
hideTransformOptions
deprecated — since v21.0.0. Use `motionOptions` instead.
stringnot documentedTransform options of the hide animation.
showTransitionOptions
deprecated — since v21.0.0. Use `motionOptions` instead.
stringnot documentedTransition options of the show animation.
hideTransitionOptions
deprecated — since v21.0.0. Use `motionOptions` instead.
stringnot documentedTransition options of the hide animation.
motionOptionsMotionOptions | undefinednot documentedThe motion options.
breakpoints{ [key: string]: any } | undefinednot documentedObject literal to define styles per screen size.
OutputTypeDescription
onCloseEventEmitter<ToastCloseEvent>Callback to invoke when a message is closed.
Template slotDescription
<ng-template #message>Custom message template.
<ng-template #headless>Custom headless template.

Inherited from BaseComponent

inherited
InputTypeDefaultDescription
dtObject | undefined undefined Defines scoped design tokens of the component.
unstyledboolean | undefined undefined Indicates whether the component should be rendered without styles.
ptPT | undefined undefined Used to pass attributes to DOM elements inside the component. Keys become attributes, and a key that names a DOM property is also assigned to that property. Values the browser would execute go through Angular's sanitizer first, as in a template binding: markup in `innerHTML`, `outerHTML` and `srcdoc`, and URLs in `href`, `src`, `action`, `formaction` and `xlink:href`. To write one of those unsanitized on purpose, pass a `DomSanitizer.bypassSecurityTrustHtml` or `bypassSecurityTrustUrl` value. An `on*` key must be a function, and any other value for it is ignored. Keys themselves are applied as given, so let data from users choose values, never keys.
ptOptionsPassThroughOptions | undefined undefined Used to configure passthrough(pt) options of the component.