id: alert
label: Alert
family: family-e-feedback
category: Feedback
intent: Display important static messages
description: Alert message box
composable: true
capabilities:
required_parts: []
optional_parts: ["AlertTitle", "AlertDescription", "AlertCloseButton"]
tags: ["alert", "warning", "info", "message", "error"]
keywords:
pain: Alerts use wrong ARIA roles causing accessibility issues silently
promise: Semantic state drives ARIA role and live region — variant is visual only
why: |
Semantic state (error/warning/success) is derived from variant at the primitive level and drives role and aria-live. Visual styling via data-rs-variant is separate from semantic contract. Accessibility is guaranteed at compile-time.
rules: ["CR-001", "CR-004"]
use_cases: ["error messages", "status notifications"]
related: ["toast", "banner", "callout", "inline_notice", "status_dot"]
file: alert_ui.css
tokens: alert-*, space-*, radius-*, font-*, motion-*
foundation: spacing, radius, typography, motion
states: ["open", "closed"]
island: alert_boundary.rs
pillar: feedback
badges: ["SSR Safe", "Hydration Safe", "Token Driven", "Deterministic API", "Zero Drift"]
before: |
// ❌ Typical
view! {
<div class="alert alert-error">"Error occurred"</div>
}
after: |
// ✅ CanonRS
view! {
<Alert variant=AlertVariant::Destructive>
<AlertTitle>"Error"</AlertTitle>
<AlertDescription>"Error occurred"</AlertDescription>
</Alert>
}
boundary_type: init
block: []
blocks_primitives: [stack]