Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.88 KB

README.md

File metadata and controls

63 lines (43 loc) · 1.88 KB

Window Control UI

Native-like window control UI for web desktop applications.

Screenshot 2024-02-07 at 19 52 05

npm i @sevn/window-control-ui

Usage

If you're a Svelte user, you're at home. Simply install this package and use it as follows:

<script>
  import { Control } from "@sevn/window-control-ui";
</script>

<Control
  os="windows | macos"
  darkmode={true | false}
  on:minimize
  on:maximize
  on:close />

You can also use with vanilla HTML and JavaScript:

<script src="https://unpkg.com/@sevn/[email protected]/dist/umd/index.js"></script>
      
<script>
  const control = new WindowControlUI.Control({
    target: document.body, // target DOM element to render
    props: {
      os: "windows | macos",
      darkmode: true | false
    }
  })

  control.$on("minimize", () => console.log("mimimized!"));
  control.$on("maximize", () => console.log("maximized!"));
  control.$on("close", () => console.log("closed!"));
</script>

How do I use it with React?

If you're trying to use this project with any non-Svelte (or non-vanilla-or-plain-HTML), please help solve this issue.

How do I position the controls in my Window?

This project focus only on creating the window controls and the events for you, feel free to use CSS to position them as needed in your application window.

In this page, for example, we use a div called .controls-wrapper with Flexbox and padding to position the controls based on the OS.

Credits

Created by Claudio Holanda Jr. (@kazzkiq), made possible by SEVN.

Made in 🇧🇷