Svelte Alert - Bitblue

Provide contextual feedback messages with colored alerts, icons, borders, and dismissable variants

Alerts communicate important information without interrupting the user’s workflow.

Setup

<script lang="ts">
	import { Alert } from '.';
</script>

Default alert

<script lang="ts">
	import { Alert } from '.';
</script>

<Alert>
	<span class="font-medium">Info alert!</span> Change a few things up and try submitting again.
</Alert>
<Alert color="red">
	<span class="font-medium">Danger alert!</span> Change a few things up and try submitting again.
</Alert>
<Alert color="green">
	<span class="font-medium">Success alert!</span> Change a few things up and try submitting again.
</Alert>

Bordered alert

<Alert border color="blue">
	<span class="font-medium">Info alert!</span> Change a few things up and try submitting again.
</Alert>

Alert with icon

<script lang="ts">
	import { Alert } from '.';
</script>

<Alert color="green">
	{#snippet icon()}
		<svg class="h-4 w-4" fill="currentColor" viewBox="0 0 20 20"><!-- check icon --></svg>
	{/snippet}
	<span class="font-medium">Success!</span> Your changes have been saved.
</Alert>

Dismissable alert

<Alert dismissable>
	<span class="font-medium">Info alert!</span> Click the close icon to dismiss.
</Alert>

Colors

Theme color tokens: primary, secondary, gray, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, rose.

Composition notes

  • Default content goes in children. Pass an icon snippet for a leading graphic; dismissable alerts lay out as a flex row.
  • Bind alertStatus when you need programmatic show/hide; dismiss sets it to false with the configured transition.

Props

AlertProps

PropTypeDefaultDescription
childrenSnippet—Alert message content
colorprimary | secondary | gray | red | orange | amber | yellow | lime | green | emerald | teal | cyan | sky | blue | indigo | violet | purple | fuchsia | pink | roseprimaryTheme color
roundedboolean—Rounded corners (rounded-lg)
borderboolean—Show border (color-matched)
dismissableboolean—Show close control
alertStatusbooleantrueBindable visibility
iconSnippet—Leading icon
closeIconComponent—Custom close icon component
transitionTransitionFunc—Dismiss transition
paramsParamsType—Transition params
onclick() => void—Click handler on the alert
classClassValue—Extra classes
…restdiv attrs (except color)—Forwarded to the root

Snippets

SnippetDescription
childrenMain message
iconLeading icon node

© 2026 Bitblue is a registered trademark. All Rights Reserved.