Toast
Styled live-region toast built on the toast primitive.
@zeus-web/toastFeedbackzweb add toastGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/toast/wc/auto'
</script>
<zw-toast default-open
><zw-toast-title>Saved</zw-toast-title
><zw-toast-description>Your changes are saved.</zw-toast-description
><zw-toast-close>Close</zw-toast-close></zw-toast
>tsx
import {
Toast,
ToastTitle,
ToastDescription,
ToastClose,
} from '@zeus-web/toast/react'
export function ToastExample() {
return (
<Toast defaultOpen>
<ToastTitle>Saved</ToastTitle>
<ToastDescription>Your changes are saved.</ToastDescription>
<ToastClose>Close</ToastClose>
</Toast>
)
}vue
<script setup lang="ts">
import {
Toast,
ToastTitle,
ToastDescription,
ToastClose,
} from '@zeus-web/toast/vue'
</script>
<template>
<Toast defaultOpen
><ToastTitle>Saved</ToastTitle
><ToastDescription>Your changes are saved.</ToastDescription
><ToastClose>Close</ToastClose></Toast
>
</template>Add
bash
zweb add toastImports
Styled registry component:
tsx
import { Toast } from '@/components/ui/toast'Primitive React wrapper:
tsx
import { Toast } from '@zeus-web/toast/react'Web Component entry:
ts
import '@zeus-web/toast/wc/auto'Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | - | Controlled open state. |
defaultOpen | boolean | - | Initial uncontrolled open state. |
duration | number | - | Auto-dismiss duration in milliseconds. |
status | ToastStatusValues: foreground, background | - | Live-region announcement priority. |
Events
| Event | React prop | Detail | Description |
|---|---|---|---|
open-change | onOpenChange | open: boolean, nativeEvent?: Event | Emitted when open state changes. |
Slots
| Slot | Description |
|---|---|
default | Toast title, description and close action. |
Styling
Uses Tailwind: yes
Theme tokens:
borderbackgroundforegroundring
Internal selectors:
[data-slot=toast]
Registry
Registry source: available.
Add command: zweb add toast
Type: component
Dependencies:
@zeus-web/toast
Registry dependencies:
cnglobals
Files:
templates/react/toast.tsx→components/ui/toast.tsxtemplates/vue/toast.ts→components/ui/toast.ts
AI usage rules
Do:
- Use the copied Registry wrapper for styled application UI.
Do not:
- Do not assume the headless primitive provides final visual styling.
Examples
React styled usage
tsx
import {
Toast,
ToastClose,
ToastDescription,
ToastTitle,
} from '@/components/ui/toast'
export function Example() {
return (
<Toast defaultOpen>
<ToastTitle>Deployment complete</ToastTitle>
<ToastDescription>The build is live.</ToastDescription>
<ToastClose>Dismiss</ToastClose>
</Toast>
)
}