Alert
Contextual feedback message with variant styling
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Alert } from '@dryui/ui';
</script>
<Alert.Root variant="info"><Alert.Description>Your changes have been saved.</Alert.Description></Alert.Root>Import options
Root package
import { Alert } from '@dryui/ui'Per-component subpath
import { Alert } from '@dryui/ui/alert'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
All Variants
Info
This is an informational message.
Success
Your changes have been saved.
Warning
This action cannot be undone.
Error
Something went wrong. Please try again.
<Alert.Root variant="info">
<Alert.Title>Info</Alert.Title>
<Alert.Description>This is an informational message.</Alert.Description>
</Alert.Root>
<Alert.Root variant="success">
<Alert.Title>Success</Alert.Title>
<Alert.Description>Your changes have been saved.</Alert.Description>
</Alert.Root>
<Alert.Root variant="warning">
<Alert.Title>Warning</Alert.Title>
<Alert.Description>This action cannot be undone.</Alert.Description>
</Alert.Root>
<Alert.Root variant="error">
<Alert.Title>Error</Alert.Title>
<Alert.Description>Something went wrong. Please try again.</Alert.Description>
</Alert.Root>Dismissible Alert
Dismissible
Click the close button to dismiss this alert.
<script lang="ts">
let visible = $state(true);
</script>
{#if visible}
<Alert.Root variant="info" dismissible onDismiss={() => visible = false}>
<Alert.Title>Dismissible</Alert.Title>
<Alert.Description>Click the close button to dismiss this alert.</Alert.Description>
<Alert.Close>✕</Alert.Close>
</Alert.Root>
{:else}
<Button variant="outline" onclick={() => visible = true}>Show alert</Button>
{/if}Structure
Compound components always start with Alert.Root. Use this structure block to understand required wrappers before you wire state or styling.
Alert.Root Alert.Description
Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with Alert.Root, then add only the parts you need.
Alert.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
variant | AlertVariant | 'info' | — | — |
dismissible | boolean | — | — | — |
onDismiss | () => void | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
Alert.Icon
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <span> attributes via rest props. Common examples: id, style, aria-label.
Alert.Title
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <h*> attributes via rest props. Common examples: id, style, aria-label.
Alert.Description
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | ✓ | — |
Forwards <p> attributes via rest props. Common examples: id, style, aria-describedby.
Alert.Close
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
children | Snippet | — | — | — |
Forwards <button> attributes via rest props. Common examples: type, disabled, name.