Component

Alert

Grabs attention and delivers important information.

Installation

Usage

Preview

Notice

Your bill is due tomorrow.

Notice

Closable alert.

Notice

Destructive alert.

Notice

Alert with custom icon.

Svelte Code

1
<script lang="ts">
2
  import Alert from '$lib/components/base/alert.svelte';
3
  import Icon from '@iconify/svelte';
4
</script>
5

6
<div class="grid w-full gap-4">
7
  <Alert title="Notice">
8
    <p>Your bill is due tomorrow.</p>
9
  </Alert>
10

11
  <!-- Closable -->
12
  <Alert title="Notice" closable>
13
    <p>Closable alert.</p>
14
  </Alert>
15

16
  <!-- Destructive -->
17
  <Alert title="Notice" variant="destructive">
18
    <p>Destructive alert.</p>
19
  </Alert>
20

21
  <!-- Custom Icon -->
22
  <Alert title="Notice">
23
    {#snippet icon()}
24
      <Icon class="size-6" icon="mdi:terminal-line" />
25
    {/snippet}
26
    <p>Alert with custom icon.</p>
27
  </Alert>
28
</div>
29