1.1.0 • Published 1 month ago
@vigilio/sweet v1.1.0
@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.0
1 month ago
1.0.15
3 months ago
1.0.14
3 months ago
1.0.13
3 months ago
1.0.12
4 months ago
1.0.11
5 months ago
1.0.10
5 months ago
1.0.9
5 months ago
1.0.8
6 months ago
1.0.7
6 months ago
1.0.6
6 months ago
1.0.5
6 months ago
1.0.4
6 months ago
1.0.3
6 months ago
1.0.2
6 months ago
1.0.1
6 months ago
0.0.13
6 months ago
0.0.12
7 months ago
0.0.11
7 months ago
0.0.10
7 months ago
0.0.9
7 months ago
0.0.8
7 months ago
0.0.7
7 months ago
0.0.6
7 months ago
0.0.5
7 months ago
0.0.4
7 months ago
0.0.3
7 months ago
0.0.2
7 months ago
0.0.1
7 months ago