Skip to content
angulux
@anguless/angulux/toast

toast

2 declarations3 demos
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. TRUSTED INPUT ONLY. Whatever you put here is applied to the DOM as given: keys become attributes, and a key that names a DOM property is assigned to that property directly, with no sanitizer in between. That is what makes the API useful, and it means a value reaching it from a user, a database or a CMS can execute script. Treat it like markup you wrote yourself, not like data you received.
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.
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. TRUSTED INPUT ONLY. Whatever you put here is applied to the DOM as given: keys become attributes, and a key that names a DOM property is assigned to that property directly, with no sanitizer in between. That is what makes the API useful, and it means a value reaching it from a user, a database or a CMS can execute script. Treat it like markup you wrote yourself, not like data you received.
ptOptionsPassThroughOptions | undefined undefined Used to configure passthrough(pt) options of the component.