Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hlorenzi/react-dockable

An easy-to-use dockable window manager for React, fully embracing hooks! -- https://hlorenzi.github.io/react-dockable/
https://github.com/hlorenzi/react-dockable

component dock dockable drag-and-drop gutter layout panel popout react react-hooks resizeable slider tabs typescript typescript-library window windowing

Last synced: about 2 months ago
JSON representation

An easy-to-use dockable window manager for React, fully embracing hooks! -- https://hlorenzi.github.io/react-dockable/

Awesome Lists containing this project

README

        

# react-dockable

![react-dockable example video](example.gif)

An easy-to-use dockable window manager for React,
fully embracing hooks!

[Try it right now!](https://hlorenzi.github.io/react-dockable/)

Your custom content's lifecycle hooks are respected,
so `useState`, `useEffect`, etc. work out of the box,
and state carries over even if the user rearranges
their panels.

[![npm][badge-npm-img]][badge-npm-url]

[![Discord][badge-discord-img]][badge-discord-url]

[badge-discord-img]: https://img.shields.io/discord/394999035540275222?label=Join%20the%20Discord%20server!&logo=discord
[badge-discord-url]: https://discord.com/invite/pXeDXGD

[badge-npm-img]: https://img.shields.io/npm/v/@hlorenzi/react-dockable
[badge-npm-url]: https://www.npmjs.com/package/@hlorenzi/react-dockable

## Installation

```
npm install @hlorenzi/react-dockable
```

## Example

```tsx
import * as React from "react"
import * as Dockable from "@hlorenzi/react-dockable"

function App()
{
// Create the base state,
// and set up initial content
const state = Dockable.useDockable((state) =>
{
Dockable.createDockedPanel(
state, state.rootPanel, Dockable.DockMode.Full,
)
})

// Render the root Container element,
// which handles all interactions on your behalf
return


}

// Your custom element!
function Counter()
{
const [value, setValue] = React.useState(0)
const countUp = () => setValue(value + 1)

const ctx = Dockable.useContentContext()
ctx.setTitle(`Count: ${ value }`)
ctx.setPreferredSize(300, 250)

return


{ value }
Count up!

}
```