Alert
Styled alert component family built on zw-alert primitives.
@zeus-web/alertFeedbackzweb add alertGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/alert/wc/auto'
</script>
<zw-alert variant="success">
<zw-alert-title>Deployment complete</zw-alert-title>
<zw-alert-description>
The new version is now available.
</zw-alert-description>
</zw-alert>tsx
import { Alert, AlertDescription, AlertTitle } from '@zeus-web/alert/react'
export function AlertExample() {
return (
<Alert variant="success">
<AlertTitle>Deployment complete</AlertTitle>
<AlertDescription>The new version is now available.</AlertDescription>
</Alert>
)
}vue
<script setup lang="ts">
import { Alert, AlertDescription, AlertTitle } from '@zeus-web/alert/vue'
</script>
<template>
<Alert variant="success">
<AlertTitle>Deployment complete</AlertTitle>
<AlertDescription>The new version is now available.</AlertDescription>
</Alert>
</template>Add
bash
zweb add alertImports
Styled registry component:
tsx
import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert'Primitive React wrapper:
tsx
import { Alert, AlertTitle, AlertDescription } from '@zeus-web/alert/react'Web Component entry:
ts
import '@zeus-web/alert/wc/auto'Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | AlertVariantValues: default, info, success, warning, danger | default | Visual style variant. |
live | string | polite | ARIA live region mode. |
Events
No public events documented.
Slots
| Slot | Description |
|---|---|
default | Alert content. |
Styling
Uses Tailwind: yes
Theme tokens:
bg-backgroundtext-foregroundborder
Internal selectors:
[data-slot=alert-root][data-slot=alert-title][data-slot=alert-description]
Registry
Registry source: available.
Add command: zweb add alert
Type: component
Dependencies:
@zeus-web/alertclass-variance-authority
Registry dependencies:
cnglobals
Files:
templates/react/alert.tsx→components/ui/alert.tsxtemplates/vue/alert.ts→components/ui/alert.ts
AI usage rules
Do:
- Use Alert for system messages.
- Use AlertTitle for the heading.
- Use AlertDescription for the detail.
Do not:
- Do not use Alert for persistent banners outside the page content.
Examples
React styled usage
tsx
import { Alert, AlertTitle, AlertDescription } from '@/components/ui/alert'
export function Example() {
return (
<Alert variant="info">
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>Info message here.</AlertDescription>
</Alert>
)
}