compote-ui
Version:
An opinionated UI component library for Svelte, built on top of [Ark UI](https://ark-ui.com) with additional components and features not available in the core Ark UI library.
15 lines (14 loc) • 537 B
JavaScript
import { createToaster } from '@ark-ui/svelte/toast';
const toaster = createToaster({ placement: 'bottom-end', pauseOnPageIdle: true });
function shorthand(type) {
return (title, options) => typeof title === 'string'
? toaster.create({ ...options, title, type })
: toaster.create({ ...title, type });
}
export const toast = Object.assign(toaster, {
info: shorthand('info'),
success: shorthand('success'),
warning: shorthand('warning'),
error: shorthand('error'),
loading: shorthand('loading')
});