Alert

An alert, per https://www.w3.org/TR/wai-aria-practices-1.1/#alert .

Demo

Properties

Name Default Description Change
type info primary, info, success, warning, or danger
content The content to display in the alert, which can also come from slot content
position top top-left, top, top-right, bottom-left, bottom, or bottom-right
closable true Set to true to display a close button at the right of the alert
duration 5000 The number of milliseconds to wait before closing the alert. Set to -1 to never close (but make sure you leave closable true!)

Events

Name Args
closed

Code

import { showAlert } from "svelte-toolkit";

showAlert({
  type: 'info',
  content: 'Pay attention to me!'
  position: 'top',
  closable: true,
  duration: 5000
});