Usage
Use search to jump between sections.
Basic usage
Import `svileo`, then call a method with an options object.
usage-basics
import { svileo } from 'svileo';
svileo.success({ title: 'Saved!' });
svileo.error({ title: 'Error', description: 'Try again.' });
svileo.info({ title: 'Update available' });
svileo.warning({ title: 'Low disk space' });Explicit type with `show`
show
svileo.show({ title: 'Hello', type: 'info' });Action toasts
action
svileo.action({
title: 'Undo delete',
button: {
title: 'Undo',
onClick: () => restore()
}
});Promise-driven toasts
promise
svileo.promise(saveFile(), {
loading: { title: 'Saving…' },
success: { title: 'File saved!' },
error: (err) => ({ title: 'Failed', description: String(err) })
});
svileo.promise(deleteItem(id), {
loading: { title: 'Deleting…' },
action: () => ({
title: 'Item deleted',
button: { title: 'Undo', onClick: () => restore() }
})
});