Toast
Temporary notification message
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Toast } from '@dryui/ui';
</script>
<Toast.Root>
<Toast.Provider>...</Toast.Provider>
<Toast.Title>...</Toast.Title>
<Toast.Description>...</Toast.Description>
<Toast.Close>...</Toast.Close>
<Toast.Action>...</Toast.Action>
</Toast.Root>Import options
Root package
import { Toast } from '@dryui/ui'Per-component subpath
import { Toast } from '@dryui/ui/toast'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Toast Notifications
<script lang="ts">
import { Toast, Button, Stack, toastStore } from '@dryui/ui';
</script>
<Toast.Provider position="top-right" />
<Stack direction="horizontal" gap="sm">
<Button variant="solid" onclick={() => toastStore.add({
variant: 'success', title: 'Changes saved',
description: 'Your profile has been updated successfully.', duration: 5000
})}>Success</Button>
<Button variant="outline" onclick={() => toastStore.add({
variant: 'error', title: 'Upload failed',
description: 'The file exceeds the 10 MB size limit.', duration: Infinity
})}>Error</Button>
<Button variant="soft" onclick={() => toastStore.add({
variant: 'warning', title: 'Storage almost full',
description: 'You have used 90% of your storage quota.', duration: 8000
})}>Warning</Button>
<Button variant="ghost" onclick={() => toastStore.add({
variant: 'info', title: 'New version available',
description: 'Version 2.4.0 is ready to install.', duration: 5000
})}>Info</Button>
</Stack>Structure
Compound components always start with Toast.Root. Use this structure block to understand required wrappers before you wire state or styling.
Toast.Root Toast.Provider Toast.Title Toast.Description Toast.Close Toast.Action
Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with Toast.Root, then add only the parts you need.
Toast.Provider
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
position | top-righttop-leftbottom-rightbottom-lefttop-centerbottom-center | 'bottom-right' | — | — |
children | Snippet | — | — | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Toast.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
id | string | — | ✓ | — |
variant | infosuccesswarningerror | — | — | — |
persistent | boolean | — | — | — |
progress | number | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Toast.Title
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <p> attributes via rest props. Common examples: id, style, aria-describedby.
Toast.Description
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <p> attributes via rest props. Common examples: id, style, aria-describedby.
Toast.Close
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <button> attributes via rest props. Common examples: type, disabled, name.
Toast.Action
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
onclick | () => void | — | — | — |
Forwards native HTML attributes via rest props.