Skip to main content

Toast

shadow

The Toast component provides an unobtrusive way of displaying short notifications to the user. They are designed to appear and disappear seamlessly, ensuring that important information reaches users without being intrusive.

When to use

Use wje-toast to communicate status, result of actions, or required next steps immediately.

When not to use

Do not show multiple feedback channels for the same event unless there is a strong reason.

Accessibility

Announce status updates with suitable ARIA live regions and manage focus for modal interactions.

Best Practices

  • Match message severity (info/success/warning/error) to actual user impact.
  • Use confirmations only for destructive or hard-to-reverse actions.
  • Keep timeouts consistent so users have enough time to read messages.

Attributes and Properties

No properties available for this component.

Events

NameDescription
wje-toast:after-showFired after the toast is shown.
wje-toast:after-hideFired after the toast is hidden.

Methods

startTimer

DescriptionStarts the timer. This method sets the startTime property to the current time and sets the timeoutID property to the ID of the timeout. The method also dispatches the wje-toast:after-hide custom event when the timeout expires.
Signature() => void

stopTimer

DescriptionStops the timer. This method clears the timeout and calculates the remaining time. The method is called when the toast notification is paused.
Signature() => void

resumeTimer

DescriptionResumes the timer. This method resumes the timer if the remaining time is greater than zero. The method is called when the toast notification is resumed.
Signature() => void

removeChildAndStack

DescriptionRemoves the toast notification and the toast stack. This method removes the toast notification from the toast stack and removes the toast stack from the document body if the toast stack is empty.
Signature() => void

CSS Shadow Parts

NameDescription
nativeThe native part.

CSS Custom Properties

NameDescription
headlineSpecifies the headline text of the toast. Represents the main title or heading displayed in the toast.
openIndicates whether the toast is currently open (visible). A value of true shows the toast, while false hides it.
durationDetermines the duration (in milliseconds) for which the toast is displayed. After this time, the toast will automatically close unless it is manually closed.
closableSpecifies whether the toast can be manually closed by the user. If true, the toast will include a close button or mechanism.
colorDefines the color of the toast. Accepts any valid CSS color value such as hex, RGB, or named colors.
countdownIndicates whether a countdown is displayed in the toast. When true, a visual countdown timer is shown to indicate the remaining time before the toast closes.

Slots

NameDescription
defaultThe content of the toast.
mediaThe media of the toast.