Skip to content

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 toast

Imports ​

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 ​

PropTypeDefaultDescription
openboolean-Controlled open state.
defaultOpenboolean-Initial uncontrolled open state.
durationnumber-Auto-dismiss duration in milliseconds.
statusToastStatus
Values: foreground, background
-Live-region announcement priority.

Events ​

EventReact propDetailDescription
open-changeonOpenChangeopen: boolean, nativeEvent?: EventEmitted when open state changes.

Slots ​

SlotDescription
defaultToast title, description and close action.

Styling ​

Uses Tailwind: yes

Theme tokens:

  • border
  • background
  • foreground
  • ring

Internal selectors:

  • [data-slot=toast]

Registry ​

Registry source: available.

Add command: zweb add toast

Type: component

Dependencies:

  • @zeus-web/toast

Registry dependencies:

  • cn
  • globals

Files:

  • templates/react/toast.tsx → components/ui/toast.tsx
  • templates/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>
  )
}

Released under the MIT License.