Toast Item

Toast items are individual notifications displayed within a toast container.

Toast items are the individual notifications that appear within a <wa-toast> container. This page documents the toast item's anatomy and styling options.

This is how a toast item looks!

Toast items are designed to be used within a <wa-toast> container, which manages their lifecycle and positioning. For usage examples showing how to display notifications, see the Toast documentation.

Examples

Link to This Section

Variants

Link to This Section

Use the variant attribute to change the toast item's visual style. The variant determines the accent color on the left side and the icon color. Available variants are neutral (default), brand, success, warning, and danger.

Sizes

Link to This Section

Use the size attribute to change the toast item's size.

Icons

Link to This Section

Use the icon slot to display an icon at the start of the toast item. The icon color automatically matches the variant's accent color.

Toast items work fine without icons too.

A simple notification without an icon.

Rich Content

Link to This Section

The default slot accepts any HTML content, allowing you to create rich notifications with formatted text, links, and interactive elements.

Duration

Link to This Section

The duration attribute controls how long the toast item displays before automatically dismissing (in milliseconds). The default is 5000 (5 seconds). Set to 0 to disable auto-dismissal.

When a duration is set, a progress ring appears around the close button showing the remaining time.

<wa-toast-item variant="brand" duration="5000">...</wa-toast-item>
<wa-toast-item variant="brand" duration="10000">...</wa-toast-item>
<wa-toast-item variant="brand" duration="0">...</wa-toast-item>

Hover Behavior

Link to This Section

Toast items automatically pause their countdown timer when the user hovers over them, giving more time to read the content. When the mouse leaves, the timer resets and begins counting down again.

The Close Button

Link to This Section

Every toast item includes a close button that allows users to dismiss the notification. When duration is greater than 0, the close button displays a progress ring showing the remaining time.

Click the close button on the right to dismiss →

Customizing the Accent

Link to This Section

Use the --accent-width custom property to adjust the width of the accent line, or hide it entirely.

Customizing the Padding

Link to This Section

Use the --padding custom property to adjust the internal spacing.

Importing

Link to This Section

If you're using the autoloader or a hosted project, components load on demand — no manual import needed. To cherry-pick a component manually, use one of the following snippets.

CDN npm Self-Hosted React

Import this component directly from the CDN:

import 'https://ka-f.webawesome.com/[email protected]/components/toast-item/toast-item.js';

After installing Web Awesome via npm, import this component:

import '@awesome.me/webawesome/dist/components/toast-item/toast-item.js';

If you're self-hosting Web Awesome, import this component from your server:

import './webawesome/dist/components/toast-item/toast-item.js';

To import this component for React 18 or below, use the following code:

import WaToastItem from '@awesome.me/webawesome/dist/react/toast-item/index.js';

Slots

Link to This Section

Learn more about using slots.

Attributes & Properties

Link to This Section

Learn more about attributes and properties.

Methods

Link to This Section

Learn more about methods.

Events

Link to This Section

Learn more about events.

CSS custom properties

Link to This Section

Learn more about CSS custom properties.

CSS parts

Link to This Section

Learn more about CSS parts.

Dependencies

Link to This Section

This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.

Need a hand? Report a bug Ask for help