Beyonk

## Svelte Notifications [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com) [![Svelte v3](https://img.shields.io/badge/svelte-v3-blueviolet.svg)](https://svelte.dev) Svelte Notifications component * Uses SvelteKit 🎉 * v3 compatible * Uses stores for completely hassle free operation * Can persist across full page reloads! ## Demo A [Demo of this component](https://svelte.dev/repl/dd506c546df84c1994a5ae9928ad23b1) is available. Alternatively, check the project out from github and `npm run dev`. ## Usage ```bash npm i -D @beyonk/svelte-notifications ``` ```svelte ``` ### Notification types You can call multiple types of notification: ```js const options = { timeout: 3000, // milliseconds persist: false, // automatic timeout (ignores above) showProgess: true, // Show (or Hide) the progress bar icon: null // Add svelte component to render an icon } notifier.show('danger', message, options) notifier.danger(message, options), notifier.warning(message, options), notifier.info(message, options), notifier.success(message, options) ``` ### Persisting across apps Your notifications can persist across multiple apps / page reloads, as long as they use this library. This is useful for a scenario where you show a notification and then redirect the browser to a different application, or trigger a full reload of the page. This is completely automatic and uses session storage. To ensure that notifications don't persist across apps where they should not, set the `sessionKey` attribute to something unique to each app. ```svelte ``` ### Notification themes You can customise the themes: ```svelte ``` ##### Custom types ```svelte ``` #### Timeouts You can set a default timeout: ```svelte ``` ##### Custom timeout: You can set a timeout per message ```svelte ``` ##### Show Progress: You can show or hide the progress bar per message ```svelte ``` ##### Persist You can make a message persist and never timeout, having a close button that the user can click to remove it. ```svelte ``` ##### Icons You can include custom svelte components to render icons (or anything). ```svelte // Icon.svelte ``` ## Credits * Original code by [Antony Jones](https://github.com/antony) * Idea for persistent notifications by [Henrique Borges](https://github.com/henriquehbr) * Animation and performance improvements by [Jonathan Greenemeier](https://github.com/6eDesign).