ComponentsMarkdown
Alert
Display inline status notices with subtle feedback tints, a 20px Lucide icon, and optional live-region announcements.
Live example
Neutral notice
Monoplinth defaults to dark mode unless the light class is active.
Token build ready
Run npm run tokens:build after editing semantic color definitions.
Contrast verified
All 344 semantic contrast pairs meet WCAG 2.2 AA thresholds.
Experimental API
Token names in this draft may change before the 1.0 release.
Contrast check failed
Foreground text on this surface fell below the 4.5:1 ratio.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "neutral" | "info" | "success" | "warning" | "destructive" | "neutral" | Semantic tint, border, icon, and title color. |
| live | boolean | false | Sets role="alert" for warning/destructive or role="status" for other variants. |
Sizes and tokens
| Tier / Role | Token | Value |
|---|---|---|
| Padding & gap | --space-4 / --space-3 | 16px padding · 12px icon-to-content gap |
| Corner radius | --radius-md | 8px |
| Icon | Lucide 20px | Info, CircleCheck, TriangleAlert, CircleX (2px stroke) |
| Feedback tint | --<role>-subtle / --<role>-border / --<role>-text | Step 3 fill · step 6 border · step 11 icon and title |
| Body text | --foreground | Neutral step 12 |
States
Live status region
Uses role="status" for polite updates when live is true.
Live alert region
Uses role="alert" for urgent warning and destructive notices.
Code
import { Alert, AlertDescription, AlertTitle } from "@freshgemui/monoplinth";
export function Example() {
return (
<Alert variant="warning" live>
<AlertTitle>Rate limit reached</AlertTitle>
<AlertDescription>
Retry the request after 60 seconds.
</AlertDescription>
</Alert>
);
}Do and don't
Do: Enable live only for dynamically injected alerts
Set live when an alert appears in response to user input or background status changes.
Don't: Set live on static page banners
Do not add role='alert' or role='status' to static notices present on initial page load.
Accessibility
- Renders no live-region
roleby default; settingliveassignsrole="alert"towarninganddestructivealerts androle="status"toneutral,info, andsuccess. - Leading Lucide icons use
size={20},absoluteStrokeWidth, andaria-hidden="true". - Both
-texttitles and--foregrounddescriptions meet>= 4.5:1contrast against-subtlebackgrounds.
Rationale
Using subtle step 3 tints with step 6 borders and step 11 icons keeps inline notices legible for multi-sentence copy without overpowering primary actions.