š Pre-Themed Responsive Toast Notification
This library is a personal extension of svelte-french-toast
npm i @jill64/svelte-toast
<!-- +layout.svelte -->
<script>
import { Toaster } from '@jill64/svelte-toast'
// Optional Color Palette
$: palette = {
background: '#EEE',
text: '#000',
success: '#29cf60',
error: '#cf3d29',
secondary: '#FFF',
loading: '#BBB'
}
</script>
<Toaster {palette} />
<!-- ... -->
<slot />
<!-- ... -->
<!-- +page.svelte -->
<script>
import { toast } from '@jill64/svelte-toast'
const onSuccess = () => $toast.success('Success', {
// Optional Toast Config
})
const onError= () => $toast.error('Error', {
// Optional Toast Config
})
const onPromise = () =>
$toast.promise(
// Your Promise
,
{
success: 'Success',
error: 'Error',
loading: 'Loading'
},
{
// Optional Toast Config
}
)
</script>
<button on:click={onSuccess}> Success </button>
<button on:click={onError}> Error </button>
<button on:click={onPromise}> Promise </button>