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.
Something went wrong. Please try again.
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
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'info' | 'warning' | 'error' | 'success' | 'info' | Semantic color variant |
title | ReactNode | — | Banner heading |
description | ReactNode | — | Optional body text |
children | ReactNode | — | Optional action slot (buttons, links) |
srLabel | string | — | Hidden text read before the title, for example "Warning:" |
icons | { info?, warning?, error?, success? } | — | Replaces the built-in icons. See the Icons guide |
sx | StyleXStyles | — | StyleX style override |
All other HTML attributes, such as id and role, go to the root element.
Accessibility
- The
errorvariant renders withrole="alert"so screen readers announce it immediately. All other variants (info,warning,success) render withrole="note". - The icon is decorative, so screen readers do not get the variant from it. Set
srLabel(for example "Warning:"), or make thetitlesay it. - A banner that appears after an action, such as "Payment received", is not announced with
role="note". Passrole="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.