Sync complete
All records are in sync.
components / toast
Data-driven feedback stack for transient notifications with placement, action, and dismissal behavior.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
All records are in sync.
Overview
This section explains the intent of the component before the implementation details.
Aliases
notification toast
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
toast region
stackPlacement-aware stack of transient feedback surfaces.
single toast surface
itemContains title, description, optional action, and dismiss affordance.
follow-up affordance
actionOptional quick action inside a toast item.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
items | Array<{ id: string; tone: string; title: string; description?: string; actionLabel?: string; actionHref?: string }> | — | Data-driven list of toast items to render in the stack. |
placement | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'bottom-right' | Chooses the stack placement on the viewport. |
durationMs | number | 5000 | Auto-dismiss duration for toast items. |
dismissible | boolean | true | Shows a dismiss affordance when true. |
onDismiss | (detail: { id?: string }) => void | — | Callback fired when a toast item is dismissed. |
onAction | (detail: { id?: string; value?: string }) => void | — | Callback fired when a toast action is activated. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
dismiss | { id?: string } | Fires when the user dismisses the component or one of its items. |
action | { id?: string; value?: string } | Fires when the component exposes a primary action and the user activates it. |
Slots
| Name | Description |
|---|---|
default | Toast is data-driven and does not expose direct slots in v1. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Caveats
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: save confirmationA basic transient confirmation for a successful save.
Copy snippet
<Toast items={[{ id: 'saved', tone: 'brand', title: 'Saved', description: 'Workspace updated.' }]} />Common patterns
1 example
common
Common: undo-capable feedbackUse an action when the user may want to quickly reverse or inspect the result.
Copy snippet
<Toast items={[{ id: 'archive', tone: 'warning', title: 'Archived', description: 'Project moved to archive.', actionLabel: 'Undo' }]} onAction={(detail) => console.log(detail)} />Edge cases
1 example
edge
Edge: long-running stackLonger visibility works for inspection-heavy flows but should still feel lightweight.
Copy snippet
<Toast placement="top-right" durationMs={20000} dismissible={false} items={[{ id: 'sync', tone: 'success', title: 'Sync complete', description: 'All records are in sync.' }]} />Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
placement=bottom-right
placement=top-left