Workspace
Docking layouts
A named tree of split and tab groups, rendered from a schema
// the tree is the state
<DockLayout
layout={layout}
onLayoutChange={setLayout}
/>DockLayout
@gpuixui/dockDockSplit
@gpuixui/dockDockTabs
@gpuixui/dockDockTab
@gpuixui/dockCode 58% · Outline 42%
Usage
import { DockLayout, DockTab, type DockNode } from "@gpuixui/dock";
import { useState } from "react";
const initial: DockNode = {
kind: "split",
id: "root",
orientation: "horizontal",
size: 0.6,
first: {
kind: "tabs",
id: "editor",
activeTab: "code",
tabs: [new DockTab({ id: "code", label: "Code" })],
},
second: {
kind: "tabs",
id: "preview",
activeTab: "outline",
tabs: [new DockTab({ id: "outline", label: "Outline" })],
},
};
const [layout, setLayout] = useState(initial);
<DockLayout
layout={layout}
onLayoutChange={setLayout}
renderTab={(id) => <Pane id={id} />}
/>;API
| Prop | Type | Default | Consequence |
|---|---|---|---|
layout | DockNode | — | the tree; controlled |
onLayoutChange | (layout: DockNode) => void | — | the next tree |
renderTab | (id: string) => ReactNode | — | one tab's content |
className | string | — | joined after the recipe |
Edit this page on GitHubpackages/dock/docs/dock-layout.mdx