Skip to content

Workflow Toast

<tpg-workflow-toast></tpg-workflow-toast>

General usage

Workflow Toast inform users about a task and can contain important workflow-related information, updates, feedback, or request for confirmations.

Workflow Toast are mildly disruptive, they can appear in the layout content of the Workflow Panel, or as a toast from the bottom Footer.

In both cases they do not belong with the other Workflow components.

Guidelines

WorkflowToast scale in width to the parent container and in height by their content.

Sizing:

  • min-width: 320px
  • height: hug content

No matter the content the WorkflowToast will always have 8px left and right padding

TertiaryButton and StatusBadge cannot be shown at the same time.

One of the badges must always be shown in a Default Type. Both cannot be non-Default (e.g. accent, warning, danger, error, etc..)

The Main badge will always have “Type” priority.

Examples

Slots

We are using a pattern of named slots to give you the consumer more power and flexibility. When taking advantage of the named slots its important to follow your projects design guidelines.

Leading Badge

These are the standard default version of the tpg-workflow-toast with only the leading-badge slot defined.

Trailing Badge

Use the trailing-badge slot to render a second badge component.

Trailing Tertiary Button

Use the trailing-tertiary-button slot to render a tertinary action button.

Triggering the toast

it is best to use the ToastManager to handle the triggering. Read its documentation here

The toast can be triggered by adding it to the DOM, and calling toast() on it. Note that after hide() is called (which happens automatically if you set a millisecond value for the duration attribute) the toast element is stripped from the DOM automatically. If you want to keep it around you will have to reinsert it. See the vanilla example for how to accomplish this.

However, it is worth noting that you should normally not have to do this, simply creating and discarding a toast element in each instance it is needed should work well enough in most cases. See the React example for how to do this.

Tables

Properties

Attribute Property Description Type Default Value
is-open isOpen Indicates whether or not the alert is open. You can toggle this attribute to show and hide the alert, or you can use the `show()` and `hide()` methods and this attribute will reflect the alert's open state. boolean false
duration duration The length of time, in milliseconds, the alert will show before closing itself. If the user interacts with the alert before it closes (e.g. moves the mouse over it), the timer will restart. Defaults to `-1`, meaning the alert will not close on its own. number -1
position position string ''
is-queued isQueued boolean false
_has-updated _hasUpdated boolean false

Events

Event name Reactjs attribute Description
tpg-show ontpg-show The Toast emits the custom tpg-show event when starting the opening sequence.
tpg-after-show ontpg-after-show The Toast emits the custom tpg-after-show event after being opened and done rendering in the view.
tpg-hide ontpg-hide The Toast emits the custom tpg-hide event when starting the closing sequence.
tpg-after-hide ontpg-after-hide The Toast emits the custom tpg-after-hide event when done closing and removing the Toast from DOM.

Functions

Name Description Arguments
pauseAutoHide No parameters
resumeAutoHide No parameters

Slots

Name Description
leading-badge slot reserved for badge component to be used as the message of the toast
trailing-badge slot reserved for badge component at the end of the toast
trailing-tertiary-button slot reserved for a tertiary button at the end of the toast
This is where the content of the toast will be displayed

CSS Parts

Attribute Description
content part for adding styling to the default slot

Sandbox