1.3.6 • Published 2 years ago

floating-window-ui v1.3.6

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Floating Window

TypeScript component for floating resizable windows in React. Screenshot 1


Installing

npm install floating-window-ui

OR

yarn add floating-window-ui

Usage

import React from "react";
import Window from "floating-window-ui";

const App = () => {
  return (
    <Window
      id="react-window"
      height={800}
      width={400}
      resizable={true}
      titleBar={{
        icon: "⚛",
        title: "React App Window",
        buttons: { minimize: true, maximize: true },
      }}
    >
      <div>...</div>
    </Window>
  );
};

export default App;

Window component

A floating window which can be dragged, minimized, maximized and moved across.

Props

NAMETYPEDEFAULTREQUIREDDESCRIPTION
idstringHTML id attribute
heightnumberHeight of window including Title Bar
widthnumberWidth of window including
topnumber0Top position of window with repect to parent element in px
leftnumber0Left position of window with repect to parent element in px
resizablebooleanfalseMake window resizable of not
titleBarobjectRefer Title Bar props
styleobject{}&crossCSS styles applied to content window

Title Bar properties

Title bar is a prop passed as an object to the Window Component for configuring title bar.

NAMETYPEDEFAULTREQUIREDDESCRIPTION
iconstring|HTMLImageElement" "Icon to be displayed on top left of window
titlestring"Untitled window"Window title displayed on center of title bar
buttonsobjectRefer Title Bar Button props

Title Bar Buttons properties

Buttons properies set whether to display certian buttons or not. If any property for titleBar is set in the window component, value for all buttons defaults to false.

NAMETYPEDEFAULTREQUIREDDESCRIPTION
minimizebooleantrueDisplaying minimize button
maximizebooleantrueDisplaying maximize button
close()=>void()=>{}Display close button. (Call provided function)

Contributing

For contributing open a Pull Request with any changes/suggestions. Any kind of contribution will be much appreciated.

Known Issues

Due to a bug in Firefox, the window does not moves with the mouse while dragging but will move to final position on dropping.

Refer Set screen coordinates during HTML5 drag event

Also see Dragging window on Firefox

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

0.1.0

2 years ago