@windui/window

1.0.0 • Public • Published

Developed with 🖤 by Swôth

npm install npm version

Installation

npm i @windui/window --save
yarn add @windui/window

CDN & DOM Usage

<script src="https://cdn.jsdelivr.net/npm/@windui/window@x.x.x/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>
    );
};

Package Sidebar

Install

npm i @windui/window

Weekly Downloads

35

Version

1.0.0

License

Apache-2.0

Unpacked Size

15.6 kB

Total Files

3

Last publish

Collaborators

  • swoth