@anguless/angulux/toast
Toast
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| Input | Type | Default | Description |
|---|---|---|---|
| message | ToastMessageOptions | null | undefined | not documented | |
| index | number | null | undefined | not documented | |
| life | number | not documented | |
| template | TemplateRef<ToastMessageTemplateContext> | undefined | not documented | |
| headless | TemplateRef<ToastHeadlessTemplateContext> | undefined | not documented | |
| show | string | undefined | not documented | |
| hide | string | undefined | not documented | |
| show | string | undefined | not documented | |
| hide | string | undefined | not documented | |
| motion | MotionOptions | not documented | |
| clear | any | not documented |
| Output | Type | Description |
|---|---|---|
| on | HTMLElement | |
| on | HTMLElement | |
| on | EventEmitter<ToastItemCloseEvent> |
Inherited from BaseComponent
inherited| Input | Type | Default | Description |
|---|---|---|---|
| dt | Object | undefined | undefined | Defines scoped design tokens of the component. |
| unstyled | boolean | undefined | undefined | Indicates whether the component should be rendered without styles. |
| pt | PT | 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. |
| pt | PassThroughOptions | undefined | undefined | Used to configure passthrough(pt) options of the component. |
Toast
componentagl-toastToast is used to display messages in an overlay.
| Input | Type | Default | Description |
|---|---|---|---|
| key | string | undefined | not documented | Key of the message in case message is targeted to a specific toast component. |
| auto | boolean | not documented | Whether to automatically manage layering. |
| base | number | not documented | Base zIndex value to use in layering. |
| life | number | not documented | The 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. |
| style deprecated — since v20.0.0, use `class` instead. | string | undefined | not documented | Inline class of the component. |
| position | ToastPositionType | not documented | Position of the toast in viewport. |
| prevent | boolean | not documented | It does not add the new message if there is already a toast displayed with the same content |
| prevent | boolean | not documented | Displays only once a message with the same content. |
| show deprecated — since v21.0.0. Use `motionOptions` instead. | string | not documented | Transform options of the show animation. |
| hide deprecated — since v21.0.0. Use `motionOptions` instead. | string | not documented | Transform options of the hide animation. |
| show deprecated — since v21.0.0. Use `motionOptions` instead. | string | not documented | Transition options of the show animation. |
| hide deprecated — since v21.0.0. Use `motionOptions` instead. | string | not documented | Transition options of the hide animation. |
| motion | MotionOptions | undefined | not documented | The motion options. |
| breakpoints | { [key: string]: any } | undefined | not documented | Object literal to define styles per screen size. |
| Output | Type | Description |
|---|---|---|
| on | EventEmitter<ToastCloseEvent> | Callback to invoke when a message is closed. |
| Template slot | Description |
|---|---|
| <ng-template #message> | Custom message template. |
| <ng-template #headless> | Custom headless template. |
Inherited from BaseComponent
inherited| Input | Type | Default | Description |
|---|---|---|---|
| dt | Object | undefined | undefined | Defines scoped design tokens of the component. |
| unstyled | boolean | undefined | undefined | Indicates whether the component should be rendered without styles. |
| pt | PT | 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. |
| pt | PassThroughOptions | undefined | undefined | Used to configure passthrough(pt) options of the component. |