Alert
An inline message for information, success, warning, or error.
import { Alert } from '@elluzion/iv-ui'; 01 Preview
Types
Info, success, warning, and error share one layout.
Scheduled maintenance
The edge network is read-only on Sunday from 02:00 to 03:00 UTC.
Deploy complete
Version 0.2.0 is live in all three regions.
Token expires soon
The deploy token expires in six days.
Build failed
The type check reported two errors in the docs package.
Source· svelte Show Hide
<script lang="ts">
import { Alert } from '@elluzion/iv-ui';
</script>
<div class="stack">
<Alert type="info" title="Scheduled maintenance">
The edge network is read-only on Sunday from 02:00 to 03:00 UTC.
</Alert>
<Alert type="success" title="Deploy complete">Version 0.2.0 is live in all three regions.</Alert>
<Alert type="warning" title="Token expires soon">The deploy token expires in six days.</Alert>
<Alert type="error" title="Build failed">
The type check reported two errors in the docs package.
</Alert>
</div>
<style>
.stack {
display: flex;
flex-direction: column;
gap: var(--iv_spacing-md);
width: 100%;
}
</style>02 Usage
typesets the icon and accent;errormaps torole="alert".dismissibleadds a close button wired toondismiss.- Keep the body to a sentence or two; use
titlefor the headline.
03 Examples
Dismissible
The close button calls ondismiss; the parent removes the alert.
New version available
Reload to pick up the latest build.
Source· svelte Show Hide
<script lang="ts">
import { Alert, Button } from '@elluzion/iv-ui';
let visible = $state(true);
</script>
<div class="stack">
{#if visible}
<Alert
type="info"
title="New version available"
dismissible
ondismiss={() => (visible = false)}
>
Reload to pick up the latest build.
</Alert>
{:else}
<Button size="sm" variant="outline" onclick={() => (visible = true)}>Restore alert</Button>
{/if}
</div>
<style>
.stack {
display: flex;
flex-direction: column;
align-items: start;
gap: var(--iv_spacing-md);
width: 100%;
}
</style>Body only
A title is optional; children carry the message.
This project uses 92% of its monthly build minutes.
Source· svelte Show Hide
<script lang="ts">
import { Alert } from '@elluzion/iv-ui';
</script>
<Alert type="warning">This project uses 92% of its monthly build minutes.</Alert>04 API
import { Alert } from '@elluzion/iv-ui';Props
4 props · 1 events · 1 snippets| Prop | Type | Default | Description |
|---|---|---|---|
| type | 'info' | 'success' | 'warning' | 'error' | 'info' | Status family; controls the icon and color treatment. |
| title | string | '' | Short headline for the message. |
| dismissible | boolean | false | Shows a close button. |
| className | string | '' | Extra classes merged onto the root element. |
class, id, style, aria-*, and data-* are forwarded through rest props.
Events
| Event | Handler type | Description |
|---|---|---|
| ondismiss | () => void | Called when the close button is pressed. |
The legacy on:name form is accepted for every event.
Snippets
| Snippet | Type | Description |
|---|---|---|
| children | Snippet | Message body. |
05 Accessibility
- Error alerts use
role="alert"; the other types userole="status". - The icon is decorative and hidden from assistive technology.
- The close button has an accessible name and a visible focus ring.
06 Tokens & CSS hooks
Tokens used
--iv_border --iv_error --iv_error-surface --iv_font-sans --iv_font-ui --iv_foreground --iv_foreground-dim --iv_info --iv_info-surface --iv_leading-base --iv_leading-tight --iv_outline-offset --iv_outline-width --iv_radius-sm --iv_spacing-lg --iv_spacing-md --iv_spacing-sm --iv_spacing-xl --iv_success --iv_success-surface --iv_surface-overlay --iv_surface-raised --iv_text-body --iv_text-sm --iv_weight-semibold
Class hooks
.iv-alert.iv-alert-body.iv-alert-close.iv-alert-content.iv-alert-error.iv-alert-icon.iv-alert-info.iv-alert-success.iv-alert-title.iv-alert-warning