This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Toaster
Melt/sonner-style toaster: toasts collapse into a peeking stack at the bottom-right and fan out on hover/focus.
Countdowns pause while hovered or focused, and Escape dismisses the focused toast. Portalled to the body and flagged data-driftwood-live, so a Dialog's inert background leaves it alone — a toast raised over a modal stays announced and dismissable. Announcing: an error toast is a role="alert", which every screen reader speaks the moment it is inserted. Any other toast is spoken through a polite live region that is always in the page — a role="status" that arrives together with its text is not reliably announced, and the old polite list around an alert read errors out twice. The spoken copy is removed again after a moment, so browsing the page does not meet each toast twice.
Feedback · portalled to <body> · keyboard contract
<script lang="ts">
import { Toaster } from '@l4st/driftwood';
</script>
| Light | Dark |
|---|---|
![]() |
![]() |
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
label |
string |
'Notifications' |
Names the region the toasts live in. |
dismissLabel |
string |
'Dismiss notification' |
Names each toast's dismiss button. |
classes |
Classes<ToasterPart> |
— | Classes for the parts inside: viewport (the list the toasts stack in), item (each toast's place in the stack), toast, icon, body (the title and description), title, description, close (the × button), closeIcon. Merged last, so they win; each toast carries data-type (default, success or error) to style it. |
Keyboard
| Key | Does |
|---|---|
| Escape | dismiss the focused toast |
Example
The markup behind the screenshot above, lifted from src/routes/shots/ — so it
compiles, and it is exactly what produced the image.
<script lang="ts">
import { Toaster, toast } from '$lib/index.js';
import { onMount } from 'svelte';
onMount(() => {
toast.success({ title: 'Scan complete', description: '2.56M files indexed.', duration: 0 });
toast.error({ title: 'Scan failed', description: 'Permission denied on /mnt/cold.', duration: 0 });
toast({ title: 'Settings saved', duration: 0 });
});
</script>
<Toaster />
Feedback · Badge · Alert · Progress · Spinner · Skeleton · Avatar · Image
driftwood
Layout
Actions
Forms
- Field
- Input
- FileInput
- FileList
- Textarea
- CodeEditor
- Combobox
- RadioGroup
- ColorSwatches
- NumberInput
- InlineEdit
- Label
- Select
- MultiSelect
- DatePicker
- TagsInput
- Checkbox
- Switch
- Slider
Feedback
Charts
Overlays
Navigation
Generated from the source by pnpm wiki · repository · v0.34.0

