Xzero UI
Pro library

Alert

A persistent message that helps people recover or continue.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/alert
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/alert

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Alert } from "@/components/xzero/alert/alert";

export function BillingNotice() {
  return (
    <Alert tone="warning" title="Card expires soon" onDismiss={() => track("dismissed")}>
      Update your payment method before March 1 to avoid interruption.
    </Alert>
  );
}

API reference

Alert

An inline message with a tone icon, title, and optional details that morph when they change.

PropTypeDefaultDescription
title (required)string–Headline. A new title rises in over the old one.
tone"info" | "success" | "warning" | "danger""info"Colour and icon. Danger uses role="alert"; the rest use role="status".
childrenReactNode–Details under the title. String children crossfade when they change.
openboolean–Controls presence. Hiding collapses the height and fades it out.
onDismiss() => void–Shows a dismiss button. Uncontrolled alerts collapse first, then call this.
...propsHTMLAttributes<HTMLDivElement>–Forwarded to the alert element, such as className and id.

Keyboard interactions

KeysAction
Enter / SpaceActivates the dismiss button when present.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in messages

Guidance for AI tools

Alert: A persistent message that helps people recover or continue. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components