Form outcome
Confirm that a save finished or explain what prevented submission.
Components / Display
A static notice surface with composable title, description, action, and icon regions.
Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.
bunx --bun @getweini/cli@latest add alertImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
<script setup lang="ts">
import Alert from './components/ui/alert/Alert.vue'
import AlertAction from './components/ui/alert/AlertAction.vue'
import AlertDescription from './components/ui/alert/AlertDescription.vue'
import AlertTitle from './components/ui/alert/AlertTitle.vue'
import Button from './components/ui/button/Button.vue'
</script>
<template>
<Alert variant="warning">
<AlertTitle>Payment method expiring</AlertTitle>
<AlertDescription>Update the card before the next invoice.</AlertDescription>
<AlertAction><Button variant="outline">Update card</Button></AlertAction>
</Alert>
</template>No live-region role is added by default. Use alert only for urgent content inserted dynamically, status for polite updates, and neither for ordinary static page content.
Confirm that a save finished or explain what prevented submission.
Keep an important policy or deadline visible with a relevant action.
A polite status works for an update inserted after an action.
<script setup lang="ts">
import Alert from './components/ui/alert/Alert.vue'
import AlertDescription from './components/ui/alert/AlertDescription.vue'
import AlertTitle from './components/ui/alert/AlertTitle.vue'
</script>
<template>
<Alert role="status" variant="success">
<AlertTitle>Changes saved</AlertTitle>
<AlertDescription>Your preferences are ready on every device.</AlertDescription>
</Alert>
</template>A notice already present at page load does not need a live-region role.
<script setup lang="ts">
import Alert from './components/ui/alert/Alert.vue'
import AlertAction from './components/ui/alert/AlertAction.vue'
import AlertDescription from './components/ui/alert/AlertDescription.vue'
import AlertTitle from './components/ui/alert/AlertTitle.vue'
import Link from './components/ui/link/Link.vue'
</script>
<template>
<Alert variant="warning">
<AlertTitle>Review your billing address</AlertTitle>
<AlertDescription>The next invoice is due on 30 September.</AlertDescription>
<AlertAction><Link href="/billing">Open billing</Link></AlertAction>
</Alert>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|---|---|---|
variantprop | "default" | "info" | "success" | "warning" | "destructive" | undefined | "default" | Choose the visual treatment for this component. |
roleprop | "alert" | "status" | undefined | Not set | Set the semantic role announced to assistive technology. |
defaultslot | () => unknown | Required | Content shown inside Alert. |
iconslot | (() => unknown) | undefined | Optional | Content for the icon area of Alert. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside AlertAction. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
defaultslot | () => unknown | Required | Content shown inside AlertDescription. |
| Name | Type or signature | Default | What it does |
|---|---|---|---|
asprop | "h2" | "h3" | "h4" | "h5" | "h6" | undefined | "h3" | Choose the HTML element or Vue component used for this control. |
defaultslot | () => unknown | Required | Content shown inside AlertTitle. |
// packages/frameworks/vue/components/alert/types.ts
import type { alertVariants } from './styles'
// ------- TYPES -------
export interface AlertProps {
variant?: keyof typeof alertVariants
role?: 'alert' | 'status'
}
export interface AlertTitleProps {
as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
}
// packages/frameworks/vue/components/alert/styles.ts
// Add or change an Alert color here; the public variant type follows these keys.
export const alertVariants = {
default: 'border-border bg-card text-card-foreground',
info: 'border-info-subtle-border bg-info-subtle text-info-subtle-foreground',
success: 'border-success-subtle-border bg-success-subtle text-success-subtle-foreground',
warning: 'border-warning-subtle-border bg-warning-subtle text-warning-subtle-foreground',
destructive:
'border-destructive-subtle-border bg-destructive-subtle text-destructive-subtle-foreground',
} as const