Toast
Confirms outcomes and communicates transient feedback without interrupting the current flow.
Design
Functional preview
Running with the stable ds-tis/toast JavaScript runtime.
Open the HTML/CSS/JS playground
Anatomy
Alterações salvas
Seu rascunho foi atualizado.
Demo
Usage
When to use
- A completed action needs brief confirmation without blocking the task.
- Feedback may disappear without removing information required to continue.
When not to use
- The message requires a decision, critical confirmation, or correction before continuing.
- Content must remain associated with a field or a specific page context.
Implementation
- Status
- Stable
- Distribution
- npm package
Installation
npm install ds-tispnpm add ds-tisyarn add ds-tisbun add ds-tisImports
import 'ds-tis/css'
import { showToast } from 'ds-tis/toast'
showToast({
type: 'success',
style: 'subtle',
title: 'Preferências salvas',
description: 'As alterações já estão disponíveis para esta conta.',
})Markup
<button class="ds-button ds-button--primary ds-button--md" type="button">
<span class="ds-button__label">Salvar preferências</span>
</button>Web implementation contract
Required runtime
Queueing, live regions, auto-hide, pausing, dismissal, and actions depend on ds-tis/toast. Without an action, the default duration is 5 seconds. With an action, there is no auto-hide by default; an explicit duration is never shorter than 10 seconds. The limit is five visible toasts and two actions per toast.
The runtime emits ds-toast-show, ds-toast-dismiss, and ds-toast-action from the region, with bubbling and details for the affected Toast.
Accessibility
Accessibility
role="status" region. Error uses role="alert". The runtime does not move focus; hover and focus pause the timer; Escape dismisses the toast containing focus.
Output responsibility
Initialize the public runtime after render and destroy it when the owning view unmounts.
Validation evidence
Covered by the stable Storybook, public runtime tests when applicable, keyboard scenarios, responsive checks, and Axe.