logo-icon
STWUI

Alert

Alert informs users about important events.

Title


Title


Title

I am a description

Title

I am a description

svelte
<script lang="ts">
	import { Alert } from 'stwui';

	const clear = "svg-path";
	const close = "svg-path";
</script>

<Alert>
	<Alert.Title slot="title">Title</Alert.Title>
</Alert>

<Alert type="warn">
	<Alert.Title slot="title">Title</Alert.Title>
</Alert>

<Alert type="error">
	<Alert.Leading slot="leading" data={clear} />
	<Alert.Title slot="title">Title</Alert.Title>
	<Alert.Description slot="description">I am a description</Alert.Description>
	<Alert.Extra slot="extra">
		<Button ariaLabel="close" shape="circle" on:click={() => console.log('I clicked extra')}>
			<Button.Icon slot="icon" data={close} />
		</Button>
	</Alert.Extra>
</Alert>

Alert Props

type 'info' | 'warn' | 'success' | 'error' info

Alert Slots

leading <Alert.Leading slot="leading" />
title <Alert.Title slot="title" />
description <Alert.Description slot="description" />
extra <Alert.Extra slot="extra" />

Alert.Leading Props

data string (IconData)
viewBox string 0 0 24 24
size string 24px
width string 24px
height string 24px
color string currentColor
stroke string | undefined
fill string currentColor

Alert.Title Slots

default

Alert.Description Slots

default

Alert.Extra Slots

default