1.1.2 • Published 1 year ago
@vigilio/sweet v1.1.2
@Vigilio/SWEET
A simple library to open Modal or alert
Getting Started
MODAL
import from "@vigilio/src/vigilio-sweet.min.css"
import {sweetModal} from "@vigilio/sweet";
const btn = document.getElementById("btn");
btn.addEventListener("click", () => {
sweetModal({}).then((res)=>{
if(res.isConfirmed){
console.log("ok");
// you can use sweet
}
});
});
PROPS
export type Icon = "danger" | "success" | "warning" | "info";
export interface SwalProps {
title?: string;
text?: string;
icon?: Icon;
customIcon?: string | HTMLElement;
html?: string | HTMLElement;
showCloseButton?: boolean;
showCancelButton?: boolean;
confirmButtonText?: string;
confirmButtonAriaLabel?: string;
cancelButtonText?: string;
cancelButtonAriaLabel?: string;
showConfirmButton?: boolean;
timer?: number;
position?: "center" | "end" | "start";
}
// YOU CAN USE callback
sweetModal((onclose)=>{...swallprops})
ALERT
import from "@vigilio/src/vigilio-sweet.min.css"
import {sweetAlert} from "@vigilio/sweet";
const btn = document.getElementById("btn");
btn.addEventListener("click", () => {
sweetAlert({}).then((res)=>{
if(res.isConfirmed){
console.log("ok");
}
});
});
export interface SwalAlertProps {
title: string;
icon?: Icon;
customIcon?: string | HTMLElement;
html?: string | HTMLElement;
showCloseButton?: boolean;
timer?: number; // 3 = 3seg
position?: string; // "top:20px;right:20px";
height?: number;
width?: number;
}
1.1.1
1 year ago
1.1.2
1 year ago
1.1.0
1 year ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
0.0.13
2 years ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago