Anex UI logoAnex UI
npm install anexui
Documentation

Documentation

Alert

An inline status message with icon, optional title, and dismiss button. Uses role="alert" or role="status" based on severity.

Preview

Changes saved

Your profile has been updated.
Your session expires in 5 minutes.

New feature

Dark mode is now available.

Usage

import { Alert } from "anexui";

<Alert variant="info">Your session expires in 5 minutes.</Alert>
Copy code

Variants

<Alert variant="success">Profile updated successfully.</Alert>
<Alert variant="error">Failed to save changes.</Alert>
<Alert variant="warning">Unsaved changes will be lost.</Alert>
<Alert variant="info">A new version is available.</Alert>
Copy code

With title

<Alert variant="error" title="Payment failed">
  Your card was declined. Please update your billing info.
</Alert>
Copy code

Dismissible

<Alert variant="warning" onDismiss={() => setVisible(false)}>
  This action cannot be undone.
</Alert>
Copy code

Props

| Prop | Type | Default | Description | |---|---|---|---| | variant | "success" \| "error" \| "warning" \| "info" | "info" | Colour and icon | | title | string | — | Bold heading above the message | | onDismiss | () => void | — | Shows a close button; called on click |

All standard HTML <div> attributes are accepted.

Accessibility