@windui/window
v1.0.0
Published
WindUI | Window Package | by Swôth
Downloads
140
Maintainers
Readme
Installation
npm i @windui/window --save
yarn add @windui/window
CDN & DOM Usage
<script src="https://cdn.jsdelivr.net/npm/@windui/[email protected]/windui.window.min.js"></script>
<script>
new WuiWindow({
// ...props
}).show();
</script>
React Example
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>
);
};