@windui/snackbar
Developed with ❤️ by Swôth
Installation
npm i @windui/snackbar --save
yarn add @windui/snackbar
Snackbar Components ᴺᴱᵂ
new Snackbar({
title: "Hello components!",
message: "Confirm or cancel.",
options: {
type: "success",
components: {
confirmText: "Approuver",
cancelText: "Annuler",
confirmEvent: ({ $, event }) => {
alert(`Clicked to ${$.snackbar.title}`);
$.hide();
},
cancelEvent: ({ $, event }) => {
alert(`Cancelled!`);
$.hide();
}
}
}
})
CDN & DOM Usage
<script src="https://cdn.jsdelivr.net/npm/@windui/snackbar@x.x.x/windui.snackbar.min.js"></script>
<script>
new WindUI.Snackbar({
}).show();
</script>
React Example
import Snackbar from "@windui/snackbar";
export default function Index() {
const trigger = () => {
const hello = new Snackbar({
options: {
duration: 3000,
speed: 500,
type: "info",
align: "right",
position: "bottom"
},
title: "Hello World!",
message: "No post on Sundays!"
});
hello.show();
};
return (
<button onClick={trigger}>
Show Snackbar!
</button>
);
};