Svelte-Sileo.
An opinionated toast component for Svelte. Gooey SVG morphing, spring physics, and a minimal API — beautiful by default.
An opinionated toast component for Svelte. Gooey SVG morphing, spring physics, and a minimal API — beautiful by default.
Quick Setup
<script lang="ts">
import { Toaster, sileo } from 'svelte-sileo';
</script>
<Toaster position="top-right" />
<button onclick={() => sileo.success({ title: 'Changes saved' })}>
Show Toast
</button>Playground
Mode
Single mode enabled.
Position
Available positions: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right.
Documentation
Use id for deterministic replacement behavior.
import { sileo } from 'svelte-sileo';
sileo.setPosition('bottom-center');
sileo.setMultiple(true);
sileo.setOptions({ duration: 3000 });
const id = sileo.success({ title: 'Queued' });
sileo.dismiss(id);
sileo.clear();Success
sileo.success({ title: 'Changes saved' });Error
sileo.error({
title: 'Something went wrong',
description: 'Please try again later.'
});Warning
sileo.warning({ title: 'Storage almost full' });Info
sileo.info({ title: 'New update available' });Action
sileo.action({
title: 'File uploaded',
description: 'Share it with your team?',
button: { title: 'Share', onClick: () => {} }
});Custom Icon
import RocketIcon from './RocketIcon.svelte';
sileo.success({
title: 'Deployed',
icon: RocketIcon
});Promise
sileo.promise(new Promise((r) => setTimeout(r, 2000)), {
loading: { title: 'Saving record...' },
success: { title: 'Record saved' },
error: { title: 'Failed to save' }
});<Toaster
position="top-right"
multiple={false}
offset={8}
options={{
duration: 6000,
autopilot: { expand: 150, collapse: 4000 }
}}
/>You can pass a Svelte component to description for rich content.
import InvoiceToast from './InvoiceToast.svelte';
sileo.success({
title: 'Invoice sent',
description: InvoiceToast,
button: { title: 'View', onClick: () => {} }
});Control background with fill and override classes per part with styles.
sileo.success({
title: 'Dark mode',
fill: '#171717',
styles: {
title: 'text-white',
description: 'text-neutral-300',
badge: 'bg-white/10',
button: 'bg-white/10 hover:bg-white/20'
}
});