Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
The four status roles
Info, success, warning and destructive (also danger). The icon carries the role colour; the text stays color.text. Banners that are on the page from the start use role="status".
AlertRoles.vue
<script setup lang="ts">
import { CircleCheck, Info, OctagonX, TriangleAlert } from '@lucide/vue'
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
</script>
<template>
<div class="flex w-full max-w-120 flex-col gap-(--bh-space-150)">
<Alert variant="info" role="status">
<Info />
<AlertTitle>Orders sync every 15 minutes</AlertTitle>
<AlertDescription>New orders from the online store reach the ERP within a quarter of an hour.</AlertDescription>
</Alert>
<Alert variant="success" role="status">
<CircleCheck />
<AlertTitle>All 1,240 orders synced</AlertTitle>
<AlertDescription>The last run finished at 09:30 with no errors.</AlertDescription>
</Alert>
<Alert variant="warning" role="status">
<TriangleAlert />
<AlertTitle>Stock levels are 2 hours old</AlertTitle>
<AlertDescription>The warehouse connection is slow. Stock may be out of date until it catches up.</AlertDescription>
</Alert>
<Alert variant="destructive">
<OctagonX />
<AlertTitle>Orders are not syncing</AlertTitle>
<AlertDescription>The ERP rejected the API key. Ask an admin to reconnect the ERP.</AlertDescription>
</Alert>
</div>
</template>With an action
AlertAction puts one small button at the end. Its label says what it does.
AlertWithAction.vue
<script setup lang="ts">
import { TriangleAlert } from '@lucide/vue'
import { Alert, AlertAction, AlertDescription, AlertTitle } from '@/components/ui/alert'
import { Button } from '@/components/ui/button'
</script>
<template>
<Alert variant="warning" role="status" class="max-w-120">
<TriangleAlert />
<AlertTitle>CRM connection expires in 3 days</AlertTitle>
<AlertDescription>Reconnect it to keep customers and deals in sync.</AlertDescription>
<AlertAction>
<Button variant="outline" size="sm">Reconnect</Button>
</AlertAction>
</Alert>
</template>Errors after a save
Shown in answer to what someone just did, so it keeps the default role="alert" and is read out at once.
AlertErrorList.vue
<script setup lang="ts">
import { OctagonX } from '@lucide/vue'
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
</script>
<template>
<!-- Shown after a failed save: role="alert" (the default) reads it out at once. -->
<Alert variant="destructive" class="max-w-120">
<OctagonX />
<AlertTitle>The mapping was not saved</AlertTitle>
<AlertDescription>
<p>Fix these 2 fields, then save again:</p>
<ul class="m-0 ps-(--bh-space-300)">
<li>SKU: each product needs one.</li>
<li>Tax class: choose a class that exists in the ERP.</li>
</ul>
</AlertDescription>
</Alert>
</template>