AlertBanner

A prominent message banner for important information or status.

Import

import { AlertBanner } from '@matix/components/alert-banner';

Usage

This is an informational message.
Your changes have been saved.
Your trial expires in 3 days.

Variants

<AlertBanner variant="info" title="A new version is available." />
<AlertBanner variant="success" title="Payment received successfully." />
<AlertBanner variant="warning" title="API rate limit is at 90%." />
<AlertBanner variant="error" title="Unable to connect to the database." />

With Description

<AlertBanner
  variant="warning"
  title="Storage almost full"
  description="You have used 95% of your available storage. Consider upgrading your plan or removing unused files."
/>

With Action

Pass interactive content as children to add actions alongside the message.

import { Button } from '@matix/components/button';

<AlertBanner
  variant="error"
  title="Deployment failed"
  description="Build exited with code 1. Check the logs for details."
>
  <Button variant="outline" size="sm">
    View logs
  </Button>
</AlertBanner>;

Custom Styles

import * as stylex from '@stylexjs/stylex';

const custom = stylex.create({
  rounded: { borderRadius: '12px' },
});

<AlertBanner variant="info" title="Custom styled banner" sx={custom.rounded} />;

API Reference

PropTypeDefaultDescription
variant'info' | 'warning' | 'error' | 'success''info'Semantic color variant
titleReactNode—Banner heading
descriptionReactNode—Optional body text
childrenReactNode—Optional action slot (buttons, links)
srLabelstring—Hidden text read before the title, for example "Warning:"
icons{ info?, warning?, error?, success? }—Replaces the built-in icons. See the Icons guide
sxStyleXStyles—StyleX style override

All other HTML attributes, such as id and role, go to the root element.

Accessibility

  • The error variant renders with role="alert" so screen readers announce it immediately. All other variants (info, warning, success) render with role="note".
  • The icon is decorative, so screen readers do not get the variant from it. Set srLabel (for example "Warning:"), or make the title say it.
  • A banner that appears after an action, such as "Payment received", is not announced with role="note". Pass role="status" for it.
  • Interactive children (buttons, links) are reachable via normal tab order.

This is an RSC-safe component — it ships no JavaScript to the browser.