
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@thebrenny/svelte-notifications
Advanced tools
Svelte Notifications component based on beyonk's, but updated for the modern era and with: - hover to pause - close without persist
Svelte Notifications component based on beyonk's, but updated for the modern era and with:
A Demo of this component is available.
Alternatively, check the project out from github and npm run dev.
npm i @thebrenny/svelte-notifications
<NotificationDisplay />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
function someFunction () {
notifier.success('Notifications work!')
}
</script>
You can call multiple types of notification:
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)
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.
<NotificationDisplay sessionKey="foo" />
You can customise the themes:
<NotificationDisplay {themes} />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
let themes = { // These are the defaults
danger: '#bb2124',
success: '#22bb33',
warning: '#f0ad4e',
info: '#5bc0de',
default: '#aaaaaa' // relates to simply '.show()'
}
function someFunction () {
notifier.success('Notifications work!')
}
</script>
<NotificationDisplay {themes} />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
let themes = {
myColour: '#ff00bb'
}
function someFunction () {
notifier.send('myColour', 'Notifications work!')
}
</script>
You can set a default timeout:
<NotificationDisplay {timeout} />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
let timeout = 3000 // The default
function someFunction () {
notifier.success('Notifications work!')
}
</script>
You can set a timeout per message
<NotificationDisplay />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
function someFunction () {
notifier.success('Notifications work!', { timeout: 5000 }) // built in theme
notifier.send('custom-theme', 'Notifications work!', { timeout: 5000 }) // custom theme
}
</script>
You can show or hide the progress bar per message
<NotificationDisplay />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
function someFunction () {
notifier.success('Notifications work!', { showProgress: false }) // built in theme
notifier.send('custom-theme', 'Notifications work!', { showProgress: true }) // custom theme
}
</script>
You can make a message persist and never timeout, having a close button that the user can click to remove it.
<NotificationDisplay />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
function someFunction () {
notifier.success('Notifications work!', { persist: true }) // built in theme
notifier.send('custom-theme', 'Notifications work!', { persist: true }) // custom theme
}
</script>
You can include custom svelte components to render icons (or anything).
<NotificationDisplay />
<button on:click={someFunction}>Show message</button>
<script>
import { NotificationDisplay, notifier } from '@thebrenny/svelte-notifications'
impoer Icon from 'somewhere/Icon.svelte'
function someFunction () {
notifier.success('Notifications work!', { icon: Icon })
}
</script>
// Icon.svelte
<svg width="1em" height="1em" viewBox="0 0 36 36">
<path
fill="currentColor"
d="M18 34a16 16 0 1 1 16-16a16 16 0 0 1-16 16Zm0-30a14 14 0 1 0 14 14A14 14 0 0 0 18 4Z"
</path>
</svg>
Everything you need to build a Svelte library, powered by sv.
Read more about creating a library in the docs.
If you're seeing this, you've probably already done this step. Congrats!
# create a new project in the current directory
npx sv create
# create a new project in my-app
npx sv create my-app
Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
Everything inside src/lib is part of your library, everything inside src/routes can be used as a showcase or preview app.
To build your library:
npm pack
To create a production version of your showcase app:
npm run build
You can preview the production build with npm run preview.
To deploy your app, you may need to install an adapter for your target environment.
Go into the package.json and give your package the desired name through the "name" option. Also consider adding a "license" field and point it to a LICENSE file which you can create from a template (one popular option is the MIT license).
To publish your library to npm:
npm publish
FAQs
Svelte Notifications component based on beyonk's, but updated for the modern era and with: - hover to pause - close without persist
We found that @thebrenny/svelte-notifications demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.