Alert
Two components for communicating important information: Alert — an inline status banner, and AlertDialog — a blocking confirmation modal for destructive or critical actions.
Variants
Four semantic variants each with a matching icon. Click the ✕ buttons to dismiss.
Info
Your export is being prepared. We'll notify you when it's ready.
Success
Changes saved successfully. All team members have been notified.
Warning
You're approaching your storage limit. Consider upgrading your plan.
Danger
Failed to connect to the server. Please check your network settings.
import { Alert } from "@usevyre/react";
{/* With title */}
<Alert variant="info" title="Info">
Your export is being prepared. We'll notify you when it's ready.
</Alert>
<Alert variant="success" title="Saved!">
Changes saved successfully.
</Alert>
<Alert variant="warning" title="Heads up">
You're approaching your storage limit.
</Alert>
<Alert variant="danger" title="Error">
Failed to connect to the server.
</Alert> <script setup>
import { Alert } from "@usevyre/vue";
</script>
<template>
<Alert variant="success" title="Saved!">
Changes saved successfully.
</Alert>
<Alert variant="warning" title="Heads up">
You're approaching your storage limit.
</Alert>
</template> Without title
Omit title for a concise single-line alert.
Your session will expire in 5 minutes. Save your work to avoid losing changes.
This feature is in beta and may change without notice.
<Alert variant="info">
Your session will expire in 5 minutes.
</Alert> <Alert variant="info">Your session will expire in 5 minutes.</Alert> AlertDialog — confirmation modal
AlertDialog renders as a portal overlay with focus trap and Escape support.
Always use it for destructive actions that cannot be undone.
import { AlertDialog, Button } from "@usevyre/react";
const [open, setOpen] = useState(false);
<Button variant="danger" onClick={() => setOpen(true)}>Delete workspace</Button>
<AlertDialog
open={open}
onOpenChange={setOpen}
title="Delete workspace?"
description="This action cannot be undone."
variant="danger"
confirmLabel="Delete workspace"
onConfirm={handleDelete}
onCancel={() => console.log("cancelled")}
/> <script setup>
import { AlertDialog, Button } from "@usevyre/vue";
const open = ref(false);
</script>
<template>
<Button variant="danger" @click="open = true">Delete workspace</Button>
<AlertDialog
v-model="open"
title="Delete workspace?"
description="This action cannot be undone."
variant="danger"
confirm-label="Delete workspace"
@confirm="handleDelete"
/>
</template> AlertDialog variants
<AlertDialog variant="danger" title="Delete?" ... />
<AlertDialog variant="warning" title="Proceed?" ... />
<AlertDialog variant="info" title="Confirm?" ... /> <AlertDialog variant="danger" title="Delete?" ... /> Alert props
Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "info" | "success" | "warning" | "danger" | "info" | Visual style and icon of the alert. |
title | string | — | Optional bold title above the description. |
onClose / @close | () => void | — | When provided, a dismiss ✕ button is rendered. |
#icon slot | slot | — | Override the default variant icon. |
class / className | string | — | Additional CSS class. |
AlertDialog props
Props
| Prop | Type | Default | Description |
|---|---|---|---|
open / v-model | boolean | — | Controlled open state. |
onOpenChange | (open: boolean) => void | — | (React) Called on close. |
title | string | — | Dialog heading. |
description | string | — | Supporting body text below the title. |
variant | "danger" | "warning" | "info" | "danger" | Icon and confirm button color. |
confirmLabel | string | "Confirm" | Label for the confirm action button. |
cancelLabel | string | "Cancel" | Label for the cancel button. |
onConfirm / @confirm | () => void | — | Called when confirm button is clicked. |
onCancel / @cancel | () => void | — | Called when cancel/Escape/backdrop is triggered. |
Valid props
| Prop | Values | Default |
|---|---|---|
variant | "info"|"success"|"warning"|"danger" | info |
Common AI mistakes
- variant="error"→ Use variant="danger"
- variant="primary"→ Use variant="info" | "success" | "warning" | "danger"
Quick examples
Warning with close button
<Alert variant="warning" title="Heads up" onClose={() => setOpen(false)}>
This action cannot be undone.
</Alert>Success state
<Alert variant="success" title="Saved!">Your changes have been saved.</Alert>