Skip to main content

React-Simple-Dock

PyPI - pret-simple-dock npm - react-simple-dock GitHub Workflow Status

A set of React components to create a dockable interface, allowing to arrange and resize tabs, collapse panels in place and move them to new windows.

Installation of the javascript package

npm install react-simple-dock

Installation of the PRET python package

pip install pret-simple-dock

Demo

Edit react-simple-dock

Usage

import React, { useRef, useState } from "react";
import ReactDOM from "react-dom";
import { Layout, LayoutHandle, Panel } from "react-simple-dock";

const DEFAULT_CONFIG = {
    kind: "row",
    size: 100,
    children: [
        {
            kind: "column",
            size: 50,
            children: [
                { kind: "leaf", tabs: ["Panel 1"], tabIndex: 0, size: 50 },
                { kind: "leaf", tabs: ["Panel 2"], tabIndex: 0, size: 50 },
            ],
        },
        { kind: "leaf", tabs: ["Panel 3"], tabIndex: 0, size: 50 },
    ],
};

const App = () => {
    const dock = useRef<LayoutHandle>(null);
    const [collapsed, setCollapsed] = useState(["Panel 2"]);
    return (
        <div style={{ background: "#bdbdbd", width: "100vw", height: "100vh" }}>
            <button onClick={() => dock.current!.popOut("Panel 3")}>Open Panel 3 in a new window</button>
            <Layout
                ref={dock}
                /* optional initial layout config */
                defaultConfig={DEFAULT_CONFIG}
                /* optional, also poppedOut and focused */
                collapsed={collapsed}
                onCollapsedChange={setCollapsed}
            >
                <Panel key="Panel 1">
                    <p>Content 1</p>
                </Panel>
                <Panel key="Panel 2" header={<i>Italic title</i>}>
                    <p>Content 2</p>
                </Panel>
                <Panel key="Panel 3">
                    <p>Content 3</p>
                </Panel>
            </Layout>
        </div>
    );
};

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(<App />);

Dynamic tab placement

When children are added/removed dynamically, Layout now preserves user-arranged layout and applies place only when a panel appears for the first time in the current layout.

<Layout
    defaultConfig={{
        kind: "row",
        children: [
            { kind: "leaf", tabs: ["Panel 1", "@anchor-1"] },
            { kind: "leaf", tabs: ["Panel 2"] },
        ],
    }}
>
    <Panel key="Panel 1">...</Panel>
    <Panel key="Panel 2">...</Panel>

    {/* Insert into the same tab list */}
    <Panel key="Panel 3" place={{ where: "after-tab", of: "Panel 1" }}>
        ...
    </Panel>

    {/* Insert as a sibling leaf around the target leaf */}
    <Panel key="Panel 4" place={{ where: "right", of: "@anchor-1" }}>
        ...
    </Panel>
</Layout>
  • where supports: before-tab, after-tab, first-tab, last-tab, left, right, top, bottom.
  • of references panel keys (or anchor tabs in defaultConfig, such as @anchor-1).
  • If of is missing, placement falls back to the first tab currently present in the layout.
  • Tabs prefixed with @ are treated as virtual anchors: preserved for placement, but never rendered as visible tabs or leaves.

Development

Installation

Clone the repository:

git clone https://github.com/percevalw/react-simple-dock.git
cd react-simple-dock

Install the dependencies:

yarn install

Make your changes and run the demo:

yarn start

Build the javascript library

To build the javascript library:

yarn build:lib

Build the PRET python package

Ensure pret is installed.

pip install pret

If you have changed the signature of the components, you will need to update the python stubs.

pret stub . SimpleDock pret_simple_dock/__init__.py

To build the python library and make it available in your environment:

pip install .

Release

Run the Prepare Release PR workflow with a version or a bump, and merge the PR it opens to publish pret-simple-dock on PyPI and react-simple-dock on npm. This needs a RELEASE_PAT secret and release.yml as trusted publisher on PyPI and npm. Each pushed branch also gets its builds on a branch-<name> pre-release.

Metadata

Release files for pret-simple-dock 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pret-simple-dock 0.3.0
File Interpreter ABI Platform Actions
pret_simple_dock-0.3.0-py3-none-any.whl Python 3 none any Details for pret_simple_dock-0.3.0-py3-none-any.whl

Release files / pret_simple_dock-0.3.0-py3-none-any.whl

Download URL pret_simple_dock-0.3.0-py3-none-any.whl
Size 56.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
298b4fcab46b01f8c5892a092ea79ea7fe86255cfc08682a7a39e6e0d48f6f1c
BLAKE2b-256 checksum
How to use checksums
759710923cba690dbe61d7f113ad1783f1f26ce07d43de0e7846d5171465a16a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for pret-simple-dock 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for pret_simple_dock-0.3.0-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page