npm i @windui/window --save
yarn add @windui/window
<script src="https://cdn.jsdelivr.net/npm/@windui/window@x.x.x/windui.window.min.js"></script>
<script>
new WuiWindow({
// ...props
}).show();
</script>
import Window from "@windui/window";
export default function Index() {
const trigger = () => {
const hello = new Window({
options: {
speed: 250, // animation speed
headerColor: "#fff", // header text color
headerBg: "#101010", // header bg color
iconColor: "#ef4444", // header icon color
bodyColor: "#fff", // body text color
bodyBg: "#202020", // body bg color
shadowColor: "#00000033" // window shadow color
},
title: "Hello World!", // window title
icon: "🛠️", // only emojis!
body: `
<h1>hi!</h1>
` // html supported
});
// returns promise
hello.open().then(({ $, success, inputs }) => {
// returns false when the user closes the window
if (success == true) { // if submitted
$.close(); // there is no automatic close.
console.log(inputs); // Object[]
};
});
};
return (
<button onClick={trigger}>
Open Window!
</button>
);
};