Alerts
Display customizable alerts to garner attention and provide critical actions.
import { Alert } from '@brainandbones/skeleton';
Examples
Hello Skeleton!
Hello Skeleton!
Hello Skeleton!
Usage
let visible: boolean = true;
<Alert {visible}>
<svelte:fragment slot="lead">(icon)</svelte:fragment>
<svelte:fragment slot="title">(title)</svelte:fragment>
<span>(message)</span>
<svelte:fragment slot="trail">(trail)</svelte:fragment>
</Alert>
Properties
Prop | Type | Default | Description |
---|---|---|---|
visible | boolean | true | Control visibility of the alert. |
background | string | bg-accent-500/30 | Provide classes to set background color. |
border | string | border-l-4 border-l-accent-500 | Provide classes to set the border styles. |
color | string | - | Provide classes to set text color. |
radius | string | - | Provide classes to set border radius. |
duration | number | 200 | Svelte fade transition duration. Set 0 to disable. |
Slots
Slot | Style Prop | Description |
---|---|---|
lead | slotLead | Provide a leading element, such as an icon. |
title | slotContent > .alert-title | Provide the alert title text. |
default | slotContent > .alert-message | Provide the alert message text. |
trail | slotTrail | Provide a trailing element, such as a call to action. |
Accessibility
Makes use of role="alert"
and aria-live="polite"
.