Alert

<Alert>TailwindCSS Modules

A prominent status message that can be displayed inline within a page, as a card, or as a floating notification.

InstallationColoxo CLI
npx coloxo add alert --style coloxo-css
ES Module ImportPlayground / npm package
import { Alert } from '@coloxo/ui';

Design Tokens:

--cx-brand-50: #EEF2FF--cx-success-50: #ECFDF5--cx-warning-50: #FFFBEB--cx-error-50: #FEF2F2--cx-radius-lg: 10px

1. Variant Matrix

Alerts support 4 semantic variants and 3 distinct layouts depending on the context.

InfoSuccessWarningError
Card (Default)
Inline

2. Interactive Props Configurator

Show Description

Show Action Button

Closable

Visual Render Canvas
tsx
<Alert  variant="info"  type="card"  title="Policy update"  description="Changes take effect Monday."  closable/>

3. Dark theme

Alert backgrounds map to distinct dark mode palettes to maintain their semantic meaning.

4. Enterprise layout compositions

Inline alerts are perfect for form validation blocks, while cards sit at the top of content sections.

Billing Information

Accessibility

Role Alert

Alerts automatically carry `role="alert"` which immediately interrupts the screen reader to announce the content.

Decorative Icons

Status icons (info, check, warning, error) are decorative. Screen readers rely entirely on the title and description for meaning.

Props

NameTypeDefaultDescription
variant"info" | "success" | "warning" | "error"infoTone (Ant Design type).
type"card" | "inline" | "floating"cardColoxo layout — not Ant Design type.
title / messageReactNode—Main heading; message is the Ant Design alias.
descriptionReactNode—Secondary text detailing the alert context.
bannerboolean—Full-bleed banner; defaults variant to warning when variant omitted.
showIconbooleantrueShow status icon.
iconReactNode | null—Custom icon; null hides.
closableboolean | { closeIcon?, onClose?, afterClose? }—Dismiss control with optional callbacks.
closeIconReactNode—Custom close icon.
afterClose() => void—Called after exit animation (~200ms).
actionReactNode—Trailing action on the same row as content.