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.
- Slots
-
default— Default slot for the toast content.
Properties
Section titled "Properties"displayTime
Section titled "displayTime"Sets the time in milliseconds that the component stays visible.
displayTime: number keepOpen
Section titled "keepOpen"Keeps the component open after the displayTime is over.
keepOpen: boolean position
Section titled "position"Sets the position of the component in the viewport.
position: AbsolutePosition positioning
Section titled "positioning"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 Methods
Section titled "Methods"connectedCallback
Section titled "connectedCallback"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 Returns void
Closes the component. Resolves to false when it is already closed.
hide(): Promise<boolean> Returns Promise<boolean>
Opens the component. Resolves to false when it is already open, or
when container positioning finds no visible ancestor.
show(): Promise<boolean> Returns Promise<boolean>
toggle
Section titled "toggle"Toggles the component. Resolves to true when the state changed.
toggle(): Promise<boolean>