Alert

A callout for drawing attention to important messages.

<script lang="ts">
  import Icon from "@iconify/svelte";
  import { Alert, AlertTitle, AlertDescription } from "$lib/components/ui/alert";
</script>
 
<div class="flex w-full max-w-md flex-col gap-3">
  <Alert>
    <Icon icon="heroicons:information-circle-solid" aria-hidden="true" />
    <AlertTitle>Heads up!</AlertTitle>
    <AlertDescription
      >You can add components to your app using the CLI.</AlertDescription
    >
  </Alert>
  <Alert variant="destructive">
    <Icon icon="heroicons:exclamation-triangle-solid" aria-hidden="true" />
    <AlertTitle>Session expired</AlertTitle>
    <AlertDescription
      >Your session has expired. Please log in again.</AlertDescription
    >
  </Alert>
</div>

Installation

npx lily-svelte@latest add alert

Usage

<script lang="ts">
	import { Alert, AlertTitle, AlertDescription } from '$lib/components/ui/alert';
</script>
 
<Alert>
	<AlertTitle>Heads up!</AlertTitle>
	<AlertDescription>You can add components using the CLI.</AlertDescription>
</Alert>

Use variant="destructive" for errors. An optional <svg> as the first child renders as the leading icon.

Built by levish. The source code is available on GitHub.

Quiet by design.