Appica UIUI 1.0.0

Alert

A prominent, in-page message that draws attention to a status or event.

Usage

Alert is a banner for a message that lives in the page layout — a status, a heads-up, a result. Compose it from its parts, all under @appica/ui-react/alert:

  • Alert — the role="alert" container. Sets the variant color and layout, and owns the optional dismiss behavior.
  • AlertIcon — a leading icon slot that automatically takes the variant's color.
  • AlertTitle — the headline (<h5>).
  • AlertDescription — the supporting body text.
  • AlertAction — a trailing row for buttons.

Every part is optional except a meaningful label — most alerts have at least an AlertTitle. The slots are placed by a grid, so you can include only the ones you need and they'll lay out correctly in either layout.

For a transient, stacked notification that appears and disappears on its own, reach for a Toast instead; for a blocking confirmation, use an Alert Dialog. Alert is for messages that sit inline with your content.

Examples

Default

The neutral default variant with an icon, title, and description. Drop the parts you need inside Alert and the grid arranges them.

Variants

Seven variants color the alert for its purpose: default, primary, secondary, info, success, warning, and error. The AlertIcon inherits the variant's accent color automatically.

Inline layout

Set layout="inline" to flow the icon, title, and description onto a single row once there's room (the alert is container-query aware, so it falls back to the stacked block layout when it gets narrow). Good for slim page-top banners.

With actions

Add an AlertAction row for buttons — say a primary action and a dismiss. It sits below the text in the block layout and trails the message inline.

Dismissible

Set dismissible to add a close button. By default the alert manages its own visibility and animates out when closed. To remember the dismissal across visits, give it a persistKey — the choice is stored (in localStorage by default, or sessionStorage via persistStorage) and the alert stays hidden on return.

Controlled

Drive visibility yourself with open + onOpenChange — for instance to show a success banner after a save, or to bring a dismissed alert back.

RTL

Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.

The icon moves to the right, the dismiss button to the left, and the action row aligns to the start edge — all from CSS logical properties. For setup details and caveats, see the RTL guide.

API reference

Alert

The container. Renders a <div role="alert"> and sets the variant, layout, and dismiss behavior.

Any other <div> attribute is forwarded to the container.

AlertIcon

A leading icon slot. Renders a <span> that colors its icon to match the variant.

AlertTitle

The headline. Renders an <h5> by default.

AlertDescription

The supporting body text. Renders a <p>.

AlertAction

A trailing row for buttons. Renders a <div>.

Accessibility

  • Alert renders with role="alert", so assistive tech announces its contents when it appears — keep the message concise and meaningful.
  • Because role="alert" is an assertive live region, mount it only when there's something to announce; an alert present on every page load isn't announced on later changes.
  • The dismiss button is a real <button> with an accessible name from closeLabel (default "Dismiss"); customise it when "Dismiss" is ambiguous.
  • AlertIcon is decorative — convey meaning in the AlertTitle/AlertDescription, not the icon alone.
  • The enter/exit animation is skipped when the user prefers reduced motion.

© 2026 Appica UI. A free component library, crafted by the Appica team.