Notification is used to display content to users globally.
Usage
svelte
import { Notification } from'stwui';
// ORimportNotificationfrom'stwui/notification'; // for tree shaking
With Icon, Title, & Description
Successfully Saved!
Anyone with a link can now view this file.
svelte
<script lang="ts">
import { Notification, Button } from'stwui';
const folder = "svg-path";
const close = "svg-path";
</script>
<Notification><Notification.Leadingslot="leading"><Notification.Leading.Icondata={folder}class="text-pink-500" /></Notification.Leading><Notification.Contentslot="content"><Notification.Content.Titleslot="title">Successfully Saved!</Notification.Content.Title><Notification.Content.Descriptionslot="description">
Anyone with a link can now view this file.
</Notification.Content.Description></Notification.Content><Notification.Extraslot="extra"class="-top-2 -right-2"><Buttonon:click={() => console.log('notification closed!')} shape="circle">
<Button.Iconslot="icon"data={close} /></Button></Notification.Extra></Notification>
With Avatar, Title, & Description
New Message
Nice work on that proposal!
svelte
<script lang="ts">
import { Notification } from'stwui';
const avatar = "image.png";
</script>
<Notification><Notification.Leadingslot="leading"><Notification.Leading.Avatarslot="avatar"src={avatar} /></Notification.Leading><Notification.Contentslot="content"><Notification.Content.Titleslot="title">New Message</Notification.Content.Title><Notification.Content.Descriptionslot="description">
Nice work on that proposal!
</Notification.Content.Description></Notification.Content></Notification>
With Description & Extra
Anyone with a link can now view this file.
svelte
<script lang="ts">
import { Notification, Button } from'stwui';
const arrow_forward = "svg-path";
</script>
<Notification><Notification.Contentslot="content"><Notification.Content.Descriptionslot="description">
Anyone with a link can now view this file.
</Notification.Content.Description></Notification.Content><Notification.Extraslot="extra"class="-top-2 -right-2"><Buttontype="primary"size="sm"on:click={() => console.log('notification extra clicked!')}
>
Details
<Button.Trailingslot="trailing"data={arrow_forward} /></Button></Notification.Extra></Notification>