![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
snackbar-vue
Advanced tools
:bomb:
Features Live Demo Link: Click here !!
Vue3 Library For a snackbar notification system.
$ npm install --save snackbar-vue
{
"default": {
"primary": "#2C89F1"
},
"success": {
"primary": "#00DEB2"
},
"danger": {
"primary": "#FF0057"
},
"background": "#353535",
"textColor": "#E3E3E3",
"time": 5000,
"position": "bottom",
"margin": {
"top": "0px",
"bottom": "0px"
},
"font": "sans-serif",
"close": false,
"teleportTo": "body",
"teleportPosition": "fixed"
}
If you would like to change the position where the snackbar it's show, specifies a target element where the snackbar will be moved, by default the teleportPosition is set to fixed change it to relative. teleportTo has to be a valid query selector, example: teleportTo="#some-id" teleportTo=".some-class" teleportTo="HTMLElelement"
Example: we have in the body a div like this:
{
"teleportPosition": "relative",
"teleportTo": "#test"
}
import {SnackbarPlugin} from 'snackbar-vue';
/**
Here it's possibile to override the default configuration
**/
// With some custom method
app.use(SnackbarPlugin, {
methods: [{
name: 'test',
color: 'green'
}]
});
/*
With some custom global configuration
*/
app.use(SnackbarPlugin, {
time: 1000,
close: true,
font: {
family: 'Calibri, Candara, Segoe, Segoe UI, Optima, Arial, sans-serif',
size: '18px',
},
methods: [{
name: 'test',
color: 'green'
}]
});
Now your component it's possible to inject the snackbar:
import { useSnackbarPlugin } from 'snackbar-vue';
// optionally import default styles
import 'snackbar-vue/dist/snackbar-vue.common.css';
// ...
const snack = useSnackbarPlugin();
// Simple message with the close button
snack.show({
position: 'bottom',
text: `Test Show ${Date.now()}`,
time: 2000,
close: true,
});
// Alert message with an action
snack.danger({
position: 'bottom-right',
text: `Test Danger ${Date.now()}`,
button: 'ACTION',
time: 2000,
close: false,
action: () => { console.log('do something'); },
});
// Success message with an action
snack.success({
position: 'bottom-left',
text: `Test Success ${Date.now()}`,
button: 'ACTION',
time: 2000,
action: () => { console.log('do something'); },
});
// Custom method created from the plugin initialization
snack.test({
background: '#ffffff',
textColor: '#000000',
position: 'top',
text: `prova ${Date.now()}`,
button: 'REDO',
time: 5000,
close: true,
action: () => { console.log('do something'); },
});
FAQs
Vue3 Library Component for snackbar notification with queue
We found that snackbar-vue demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.