Alert
A component for displaying important messages with different variants (error, warning, success, info).
Installation
bash
npx @zizigy/capsule add AlertUsage
Basic Alert
html
<capsule-alert>
<capsule-alert-title>Alert Title</capsule-alert-title>
<capsule-alert-description>
This is an alert description.
</capsule-alert-description>
</capsule-alert>With Icon
html
<capsule-alert>
<svg
width="16"
height="16"
>
...
</svg>
<capsule-alert-title>Alert with Icon</capsule-alert-title>
<capsule-alert-description>Alert message</capsule-alert-description>
</capsule-alert>Variants
html
<capsule-alert variant="error">
<capsule-alert-title>Error</capsule-alert-title>
<capsule-alert-description>Something went wrong</capsule-alert-description>
</capsule-alert>Components
The Alert component consists of several sub-components:
capsule-alert
The main container for alert messages.
capsule-alert-title
The title of the alert message.
html
<capsule-alert-title>Alert Title</capsule-alert-title>capsule-alert-description
The description of the alert message.
html
<capsule-alert-description>Alert description</capsule-alert-description>Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
variant | string | default | Alert style variant |
Variant Values
default— Default alert styleerror— Error alert with red colorswarning— Warning alert with yellow/orange colorssuccess— Success alert with green colorsinfo— Info alert with blue colors
Accessibility
- ✅ ARIA role="alert" set automatically
- ✅ Title has role="heading" with aria-level="2"
- ✅ Semantic structure for screen readers
