Skip to content
Statix Design System

Display

Alert

Banner that tells the customer about something on this page, such as an approval that waits for them. Penpot calls it Notice, and @statix/ui/alert exports both names.

import * as Alert from '@statix/ui/alert';

Playground

An approval is waiting for you
yoga-berger.de: update the contact form. Nothing changes without your approval.
Controls
<Alert.Root>
	<InfoIcon />
	<Alert.Title>An approval is waiting for you</Alert.Title>
	<Alert.Description>yoga-berger.de: update the contact form. Nothing changes without your approval.</Alert.Description>
	<Alert.Action>
		<Button variant="outline" size="sm">View details</Button>
	</Alert.Action>
</Alert.Root>

Examples

Info with an action

The start page banner: icon, title, description and a button on the right. In narrow containers the action drops below the text.

An approval is waiting for you
yoga-berger.de · Update the contact form. Without your approval the form stays as it is.
<script lang="ts">
	import * as Alert from '@statix/ui/alert';
	import { Button } from '@statix/ui/button';
	import ArrowRightIcon from '@lucide/svelte/icons/arrow-right';
	import InfoIcon from '@lucide/svelte/icons/info';
</script>

<Alert.Root role="status">
	<InfoIcon />
	<Alert.Title>An approval is waiting for you</Alert.Title>
	<Alert.Description>
		yoga-berger.de · Update the contact form. Without your approval the form stays as it is.
	</Alert.Description>
	<Alert.Action>
		<Button variant="outline" class="border-primary-soft-foreground/20">
			View details
			<ArrowRightIcon data-icon="inline-end" />
		</Button>
	</Alert.Action>
</Alert.Root>

Variants

info (default), warning, success, destructive and neutral. Pick the tone by what the customer has to do, not by how important it feels.

We update WordPress tonight
We test it on a copy first. Your website stays online.
Mailbox almost full
info@yoga-berger.de uses 4.6 of 5 GB. New mail bounces at 5 GB.
Website restored
yoga-berger.de is back to the backup from today at 03:10.
Maintenance on 20 November
Email may be slow between 02:00 and 03:00.
<script lang="ts">
	import * as Alert from '@statix/ui/alert';
	import CircleAlertIcon from '@lucide/svelte/icons/circle-alert';
	import CircleCheckIcon from '@lucide/svelte/icons/circle-check';
	import InfoIcon from '@lucide/svelte/icons/info';
	import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
	import WrenchIcon from '@lucide/svelte/icons/wrench';
</script>

<div class="flex w-full flex-col gap-3">
	<Alert.Root role="status">
		<InfoIcon />
		<Alert.Title>We update WordPress tonight</Alert.Title>
		<Alert.Description>We test it on a copy first. Your website stays online.</Alert.Description>
	</Alert.Root>
	<Alert.Root variant="warning" role="status">
		<TriangleAlertIcon />
		<Alert.Title>Mailbox almost full</Alert.Title>
		<Alert.Description
			>info@yoga-berger.de uses 4.6 of 5 GB. New mail bounces at 5 GB.</Alert.Description
		>
	</Alert.Root>
	<Alert.Root variant="success" role="status">
		<CircleCheckIcon />
		<Alert.Title>Website restored</Alert.Title>
		<Alert.Description>yoga-berger.de is back to the backup from today at 03:10.</Alert.Description>
	</Alert.Root>
	<Alert.Root variant="destructive">
		<CircleAlertIcon />
		<Alert.Title>Payment failed</Alert.Title>
		<Alert.Description
			>We could not collect invoice RE-2026-0142. Check your payment method.</Alert.Description
		>
	</Alert.Root>
	<Alert.Root variant="neutral" role="status">
		<WrenchIcon />
		<Alert.Title>Maintenance on 20 November</Alert.Title>
		<Alert.Description>Email may be slow between 02:00 and 03:00.</Alert.Description>
	</Alert.Root>
</div>

Title only

A single line is enough for short confirmations.

Forwarding saved. New mail goes to jonas@yoga-berger.de.
<script lang="ts">
	import * as Alert from '@statix/ui/alert';
	import CircleCheckIcon from '@lucide/svelte/icons/circle-check';
</script>

<Alert.Root variant="success" role="status">
	<CircleCheckIcon />
	<Alert.Title>Forwarding saved. New mail goes to jonas@yoga-berger.de.</Alert.Title>
</Alert.Root>

Without an icon

The grid drops the icon column when there is no icon.

Your contract renews on 1 December
WordPress Hosting M, €24.90 per month.
<script lang="ts">
	import * as Alert from '@statix/ui/alert';
	import { Button } from '@statix/ui/button';
</script>

<Alert.Root variant="neutral" role="status">
	<Alert.Title>Your contract renews on 1 December</Alert.Title>
	<Alert.Description>WordPress Hosting M, €24.90 per month.</Alert.Description>
	<Alert.Action>
		<Button variant="outline" size="sm">See contract</Button>
	</Alert.Action>
</Alert.Root>

Inside a card

Alerts sit at the top of a card section with the card padding around them.

Domains

6 domains

berger-yoga.de expires in 12 days
Renew it now to keep the address.
<script lang="ts">
	import * as Alert from '@statix/ui/alert';
	import * as Card from '@statix/ui/card';
	import { Button } from '@statix/ui/button';
	import TriangleAlertIcon from '@lucide/svelte/icons/triangle-alert';
</script>

<Card.Root class="w-full max-w-xl">
	<Card.Header>
		<Card.Title>Domains</Card.Title>
		<Card.Description>6 domains</Card.Description>
	</Card.Header>
	<Card.Content>
		<Alert.Root variant="warning" role="status">
			<TriangleAlertIcon />
			<Alert.Title>berger-yoga.de expires in 12 days</Alert.Title>
			<Alert.Description>Renew it now to keep the address.</Alert.Description>
			<Alert.Action>
				<Button variant="dark" size="sm">Renew</Button>
			</Alert.Action>
		</Alert.Root>
	</Card.Content>
</Card.Root>

Guidelines

Do

  • Say what happened and what the customer can do: "An approval is waiting for you".
  • Give at most one action. Link to the page that resolves the notice.
  • Use warning for things that need action soon, destructive for things that already failed.

Don't

  • Don’t stack several alerts. Combine them or show the most urgent one.
  • Don’t use an alert for form validation. Use the field error text instead.
  • Don’t use alerts for marketing.

Accessibility

  • Alert renders role="alert", which screen readers announce when it appears. For a notice that is there on page load, pass role="status" or role="note" so it is not read out as urgent.
  • Put an icon first inside Alert.Root. It is decorative; the title carries the message.
  • The action is a normal button or link and follows the text in the tab order.
  • Text on every variant meets 4.5:1. Status colours only tint the icon.

API reference

Alert.Root

renders <div role="alert"> and accepts its attributes

Also exported as Notice.

PropTypeDefault
variant 'info' | 'warning' | 'success' | 'destructive' | 'neutral'

Tone. default is an alias of info for shadcn compatibility.

'info'
ref bindHTMLDivElement | null

The rendered element.

–
class ClassValue

Merged with the variant classes; yours win.

–
Data attributeMeaning
data-slot="alert"Always present.
data-variantThe current variant.

Alert.Title

renders <div> and accepts its attributes

Body medium (15/500).

Data attributeMeaning
data-slot="alert-title"Always present.

Alert.Description

renders <div> and accepts its attributes

Body text. Links inside are underlined.

Data attributeMeaning
data-slot="alert-description"Always present.

Alert.Action

renders <div> and accepts its attributes

Right column, vertically centred. Moves below the text when the alert is narrower than 28rem.

Data attributeMeaning
data-slot="alert-action"Always present.

alertVariants

The tailwind-variants function behind Alert.Root.