A contextual popup that displays a status. Toasts are triggered by clicking, focusing, or tapping an element and cannot have interactive elements within them.
<nve-toast id="toast" close-timeout="1500">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
<nve-toast id="toast" close-timeout="1500">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
hello there button
Installation
Learn more about native Popover APIs.
<script type="module">
import '@nvidia-elements/core/toast/define.js';
</script>
<nve-toast id="toast" close-timeout="1500">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
<script type="module">
import '@nvidia-elements/core/toast/define.js';
</script>
<nve-toast id="toast" close-timeout="1500">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
nve api.get nve-toast
nve api.get nve-toast
Visual
Visual example of toast structure with anchor positioning for consistent implementation patterns across your application.
<nve-toast anchor="btn">hello there</nve-toast>
<nve-button id="btn">button</nve-button>
<nve-toast anchor="btn">hello there</nve-toast>
<nve-button id="btn">button</nve-button>
Status
Communicates the intent and semantic meaning of an element to help users understand the outcome of their actions.
Status Description accent Highlights important actions or draws attention to primary interactive elements. warning Indicates cautionary actions that require careful consideration before proceeding. success Represents positive outcomes, confirmations, or constructive actions. danger Signals destructive or irreversible actions that need extra attention and confirmation. Toast status variants for different feedback types. Use success for confirmations, warning for cautions, and danger for error notifications, helping users quickly identify message importance through color and iconography.
<div nve-layout="row align:center" style="height: 200px">
<nve-toast position="top">default</nve-toast>
<nve-toast status="success" position="right">success</nve-toast>
<nve-toast status="warning" position="bottom">warning</nve-toast>
<nve-toast status="danger" position="left">danger</nve-toast>
</div>
<div nve-layout="row align:center" style="height: 200px">
<nve-toast position="top">default</nve-toast>
<nve-toast status="success" position="right">success</nve-toast>
<nve-toast status="warning" position="bottom">warning</nve-toast>
<nve-toast status="danger" position="left">danger</nve-toast>
</div>
Prominence
Sets the visual prominence of the toast.
Prominence Description muted Muted toast variant for subtle, low-priority feedback. Use muted prominence when the message is informative but shouldn't draw significant attention, maintaining user focus on primary tasks.
<nve-toast position="top" prominence="muted">muted</nve-toast>
<nve-toast position="top" prominence="muted">muted</nve-toast>
Close Timeout
Sets the automatic dismissal time in milliseconds before the element emits a close event. Allow ~200-250ms per word for comfortable reading.
CloseTimeout Description number 0 Warning or error messages requiring immediate acknowledgment. 3000 Brief success or confirmation messages. 7000 Standard informational messages. 10000 Messages with actions or requiring user decision. Basic toast with auto-dismiss for brief, non-critical feedback messages. Use toasts for lightweight confirmations like "Saved", "Copied", or "Action complete" that inform users without requiring interaction or disrupting workflow.
<nve-toast id="toast" close-timeout="1500">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
<nve-toast id="toast" close-timeout="1500">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
Events
Event Description close Dispatched when the toast closes.
open Dispatched when the toast opens.
toggle Dispatched on a popover element just after showing or hiding. MDN
beforetoggle Dispatched on a popover just before showing or hiding. MDN
Event handling for toast lifecycle events. Useful for adding custom behavior when toast state changes.
<nve-toast id="toast">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
<script type="module">
const toast = document.querySelector("nve-toast");
toast.addEventListener("beforetoggle", () => console.log("beforetoggle"));
toast.addEventListener("toggle", () => console.log("toggle"));
toast.addEventListener("close", () => console.log("close"));
toast.addEventListener("open", () => console.log("open"));
</script>
<nve-toast id="toast">hello there</nve-toast>
<nve-button popovertarget="toast">button</nve-button>
<script type="module">
const toast = document.querySelector("nve-toast");
toast.addEventListener("beforetoggle", () => console.log("beforetoggle"));
toast.addEventListener("toggle", () => console.log("toggle"));
toast.addEventListener("close", () => console.log("close"));
toast.addEventListener("open", () => console.log("open"));
</script>
Actions
Toast with inline action buttons for quick follow-up actions. Use sparingly for important actions like "Undo" or "View", but prefer simple toasts without actions for most feedback to maintain lightweight nature.
<div nve-layout="row align:center" style="height: 200px">
<nve-toast position="top"> default <nve-button container="inline">action</nve-button> </nve-toast>
<nve-toast status="success" position="right"> success <nve-button container="inline">action</nve-button> </nve-toast>
<nve-toast status="warning" position="bottom"> warning <nve-button container="inline">action</nve-button> </nve-toast>
<nve-toast status="danger" position="left"> danger <nve-button container="inline">action</nve-button> </nve-toast>
</div>
<div nve-layout="row align:center" style="height: 200px">
<nve-toast position="top"> default <nve-button container="inline">action</nve-button> </nve-toast>
<nve-toast status="success" position="right"> success <nve-button container="inline">action</nve-button> </nve-toast>
<nve-toast status="warning" position="bottom"> warning <nve-button container="inline">action</nve-button> </nve-toast>
<nve-toast status="danger" position="left"> danger <nve-button container="inline">action</nve-button> </nve-toast>
</div>
Position
Sets the side position of the popover relative to the provided anchor element.
Position Description center Centers the popover directly over the anchor element. top Positions the popover above the anchor element. bottom Positions the popover below the anchor element. left Positions the popover to the left side of the anchor element. right Positions the popover to the right side of the anchor element. Toast positioning options relative to screen edges or anchor elements. Position toasts in consistent locations where they won't obscure important content, typically bottom-center or top-right for global feedback.
<nve-toast anchor="btn" position="top">top</nve-toast>
<nve-toast anchor="btn" position="right">right</nve-toast>
<nve-toast anchor="btn" position="bottom">bottom</nve-toast>
<nve-toast anchor="btn" position="left">left</nve-toast>
<nve-button id="btn">button</nve-button>
<nve-toast anchor="btn" position="top">top</nve-toast>
<nve-toast anchor="btn" position="right">right</nve-toast>
<nve-toast anchor="btn" position="bottom">bottom</nve-toast>
<nve-toast anchor="btn" position="left">left</nve-toast>
<nve-button id="btn">button</nve-button>
Alignment
Determines the alignment of the popover relative to the provided anchor element.
Alignment Description start Aligns the popover to the beginning edge of the anchor for left or top alignment. end Aligns the popover to the ending edge of the anchor for right or bottom alignment. center Centers the popover along the anchor's edge for balanced positioning. Fine-grained toast alignment for precise placement control. Use alignment to position toasts relative to anchor edges, useful for contextual feedback that should appear near specific UI elements.
<nve-card id="card" style="width: 450px; height: 300px"></nve-card>
<nve-toast anchor="card" position="top" alignment="start">top start</nve-toast>
<nve-toast anchor="card" position="top">top center</nve-toast>
<nve-toast anchor="card" position="top" alignment="end">top end</nve-toast>
<nve-toast anchor="card" position="right" alignment="start">right start</nve-toast>
<nve-toast anchor="card" position="right">right center</nve-toast>
<nve-toast anchor="card" position="right" alignment="end">right end</nve-toast>
<nve-toast anchor="card" position="bottom" alignment="start">bottom start</nve-toast>
<nve-toast anchor="card" position="bottom">bottom center</nve-toast>
<nve-toast anchor="card" position="bottom" alignment="end">bottom end</nve-toast>
<nve-toast anchor="card" position="left" alignment="start">left start</nve-toast>
<nve-toast anchor="card" position="left">left center</nve-toast>
<nve-toast anchor="card" position="left" alignment="end">left end</nve-toast>
<nve-card id="card" style="width: 450px; height: 300px"></nve-card>
<nve-toast anchor="card" position="top" alignment="start">top start</nve-toast>
<nve-toast anchor="card" position="top">top center</nve-toast>
<nve-toast anchor="card" position="top" alignment="end">top end</nve-toast>
<nve-toast anchor="card" position="right" alignment="start">right start</nve-toast>
<nve-toast anchor="card" position="right">right center</nve-toast>
<nve-toast anchor="card" position="right" alignment="end">right end</nve-toast>
<nve-toast anchor="card" position="bottom" alignment="start">bottom start</nve-toast>
<nve-toast anchor="card" position="bottom">bottom center</nve-toast>
<nve-toast anchor="card" position="bottom" alignment="end">bottom end</nve-toast>
<nve-toast anchor="card" position="left" alignment="start">left start</nve-toast>
<nve-toast anchor="card" position="left">left center</nve-toast>
<nve-toast anchor="card" position="left" alignment="end">left end</nve-toast>
Release Status
All elements and features go through 3 phases of stability, pre-release, beta and stable.
pre-release Docs Preview API Documentation Fully Themeable
beta Robust unit test coverages Passed API Review Passed Designer VQA Review Included in library package stable No known outstanding AA WCAG issues No known outstanding performance issues Adapts to different screen/container sizes No breaking API changes for at least 90 days