A toast component is used to show a brief, non-interactive notification.

The component integrates with the Invoker Commands API: an Ignite button or a native <button> with command="--show" / "--hide" / "--toggle" and commandfor pointing to this element will call the corresponding method declaratively without any JavaScript.

Element
igc-toast
Slots
default — Default slot for the toast content.

Inherited from: IgcBaseAlertLikeComponent

Sets the time in milliseconds that the component stays visible.

displayTime: number = 4000

Defined in src/internals/mixins/alert.ts:36

Inherited from: IgcBaseAlertLikeComponent

Keeps the component open after the displayTime is over.

keepOpen: boolean = false

Defined in src/internals/mixins/alert.ts:45

Inherited from: IgcBaseAlertLikeComponent

Sets the open state of the component.

open: boolean = false

Defined in src/internals/mixins/alert.ts:27

Inherited from: IgcBaseAlertLikeComponent

Sets the position of the component in the viewport.

position: AbsolutePosition = 'bottom'

Defined in src/internals/mixins/alert.ts:54

Inherited from: IgcBaseAlertLikeComponent

Sets the positioning strategy of the component.

viewport - positions against the viewport, ignoring every ancestor. container - positions inside the bounding box of the closest visible ancestor, at the place that position sets.

positioning: NotificationPositioning = 'viewport'

Defined in src/internals/mixins/alert.ts:67

Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.

Note on Content Security Policy:

Element styles are implemented with <style> tags when the browser doesn't support adopted StyleSheets. To use such <style> tags with the style-src CSP directive, the style-src value must either include 'unsafe-inline' or nonce-<base64-value> with <base64-value> replaced be a server-generated nonce.

To provide a nonce to use on generated <style> elements, set window.litNonce to a server-generated nonce in your page's HTML, before loading application code:

``

styles: CSSResult[]

Defined in src/components/toast/toast.ts:24

Inherited from: IgcBaseAlertLikeComponent

Invoked when the component is added to the document's DOM.

In connectedCallback() you should setup tasks that should only occur when the element is connected to the document. The most common of these is adding event listeners to nodes external to the element, like a keydown event handler added to the window.

``

Typically, anything done in connectedCallback() should be undone when the element is disconnected, in disconnectedCallback().

connectedCallback(): void

Defined in src/internals/mixins/alert.ts:85

Returns void

Inherited from: IgcBaseAlertLikeComponent

Closes the component. Resolves to false when it is already closed.

hide(): Promise<boolean>

Defined in src/internals/mixins/alert.ts:167

Returns Promise<boolean>

Inherited from: IgcBaseAlertLikeComponent

Opens the component. Resolves to false when it is already open, or when container positioning finds no visible ancestor.

show(): Promise<boolean>

Defined in src/internals/mixins/alert.ts:162

Returns Promise<boolean>

Inherited from: IgcBaseAlertLikeComponent

Toggles the component. Resolves to true when the state changed.

toggle(): Promise<boolean>

Defined in src/internals/mixins/alert.ts:172

Returns Promise<boolean>