Feedback/Alert

Alert

A contextual feedback banner for informational messages, success confirmations, warnings, and error states. Supports an optional dismiss action.

import { Alert } from "@animui/ui"

Variants

Four built-in variants — each with a matching icon and color palette.

With title

Provide a title prop to add a bold heading above the message body.

Dismissible

Pass an onClose handler to render a dismiss button. Control visibility with local state.

Props

PropTypeDefaultDescription
variant"info" | "success" | "warning" | "error""info"Controls the color scheme and icon of the alert.
titlestringOptional bold heading rendered above the message body.
childrenReact.ReactNodeThe message content of the alert.
iconReact.ReactNodeCustom icon. Defaults to a built-in icon matching the variant.
onClose() => voidWhen provided, renders a dismiss button in the top-right corner.
classNamestringAdditional Tailwind classes applied to the alert container.

Accessibility

  • Renders with role="alert" so screen readers announce it immediately on mount.
  • Icons are aria-hidden="true" — the variant is conveyed via color and text, not icon alone.
  • Dismiss button includes aria-label="Dismiss" for screen reader context.
  • Color contrast ratios meet WCAG AA (4.5:1) for all four variant text colors.
© 2026 Steal Shadow. MIT License.Report an issue