Alert
Alert supports primary, secondary, success, info, and danger. It uses
role="status" by default and role="alert" for danger.
import { Alert } from '@manti-ui/react'; const variants = ['primary', 'secondary', 'success', 'info', 'danger'] as const; export default function AlertVariants() { return ( <div className="grid gap-3 w-full"> {variants.map((variant) => ( <Alert key={variant} variant={variant} title={`${variant} message`}> A smooth, colored status message that calmly explains what happened. </Alert> ))} </div> ); }
Dismissal
Provide onDismiss to show a close button. Your application owns whether the
Alert remains rendered.
Dough is resting
Give it 30 minutes before you start rolling.
API
| Prop | Type | Default | Description |
|---|---|---|---|
variant | AlertVariant | 'secondary' | Semantic treatment: primary, secondary, success, info, or danger. |
title | ReactNode | — | Bold leading line. |
icon | ReactNode | — | Leading status icon. |
onDismiss | () => void | — | Show a close button and handle dismissal. |
role | 'status' | 'alert' | — | Auto-escalates to alert for the danger variant. |
actions / footer | ReactNode | — | One or more product actions rendered below the description. |
Styling
Anatomy
| Part | Selector | Description |
|---|---|---|
root | [data-scope="alert"][data-part="root"] | The alert container. |
icon | [data-scope="alert"][data-part="icon"] | Leading status icon. |
content | [data-scope="alert"][data-part="content"] | Title + description wrapper. |
title | [data-scope="alert"][data-part="title"] | The bold leading line. |
description | [data-scope="alert"][data-part="description"] | Supporting copy. |
actions | [data-scope="alert"][data-part="actions"] | Product actions or footer content. |
dismiss | [data-scope="alert"][data-part="dismiss"] | Close button (when onDismiss). |
Tokens
| Token | Controls |
|---|---|
--manti-alert-radius | radius |
--manti-alert-padding-x | padding x |
--manti-alert-padding-y | padding y |
--manti-alert-gap | gap |
--manti-alert-icon-size | icon size |
--manti-alert-dismiss-size | dismiss size |
--manti-alert-font-size | font size |
Last updated