Skip to content
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

PropTypeDefaultDescription
variant"neutral" | "info" | "success" | "warning" | "destructive""neutral"Semantic tint, border, icon, and title color.
livebooleanfalseSets role="alert" for warning/destructive or role="status" for other variants.

Sizes and tokens

Tier / RoleTokenValue
Padding & gap--space-4 / --space-316px padding · 12px icon-to-content gap
Corner radius--radius-md8px
IconLucide 20pxInfo, CircleCheck, TriangleAlert, CircleX (2px stroke)
Feedback tint--<role>-subtle / --<role>-border / --<role>-textStep 3 fill · step 6 border · step 11 icon and title
Body text--foregroundNeutral step 12

States

Live status region
Uses role="status" for polite updates when live is true.

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 role by default; setting live assigns role="alert" to warning and destructive alerts and role="status" to neutral, info, and success.
  • Leading Lucide icons use size={20}, absoluteStrokeWidth, and aria-hidden="true".
  • Both -text titles and --foreground descriptions meet >= 4.5:1 contrast against -subtle backgrounds.

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.