Dock manager

IDE-style dockable workspace built on splitters and tab stacks. Panes can be dragged between stacks, torn off into floating windows, and the arrangement is round-trippable as a JSON DockLayoutSnapshot.

Keyboard shortcuts
  • Tab / Shift + Tab — move focus through tab strips, splitter dividers, intersection handles, and floating-pane close buttons
  • On a tab strip: ← / → move between tabs, Home / End jump to the first / last one, Enter / Space activate the focused tab
  • On a splitter divider: ← / → (or ↑ / ↓ for a vertical split) resize by 10% — Shift makes it 1% — and Home / End drive it to its limits
  • On an intersection handle (the glyph where two splits cross): ← / → drive the vertical divider and ↑ / ↓ the horizontal one; Home / End drive the vertical one; Shift is again the 1% fine step
  • On a floating pane's edge or corner handle: arrows resize along that handle's axis (10px per step, Shift for 1px)
  • Floating-pane close button — Enter / Space closes the window
  • M on a focused tab — arm pane move mode. Only the bare key arms it; Ctrl/Alt/⌘ + M is left to the browser or the app.
  • Enter / Space / M on a tool window's title — arm move mode for that pane; its × closes the pane.
  • In move mode: T / R / B / L dock the pane to the top / right / bottom / left of the current stack · Shift with T / R / B / L docks it along that outer edge of the whole dock · F tears it off into a floating window · Esc cancels
  • In move mode, to reach a stack other than the current one: → / ↓ and ← / ↑ cycle forward and backward through every drop target — the four sides of each other docked stack, then “float” — announcing “side of pane names, option N of M” and outlining the target. Enter commits the highlighted target; it lands exactly where the equivalent mouse drop would.
  • Move mode stays armed while focus moves around inside the dock and cancels once focus leaves it; the commit always applies to the pane that was focused when M was pressed. Letters typed into an input, textarea, select or contenteditable inside a pane stay text and commit nothing.
  • While dragging a pane or a window, four edge guides appear at the dock's edges: dropping on one docks it along that whole edge.

Basic usage

Captured layout

{  "root": {    "kind": "split",    "direction": "horizontal",    "sizes": [      1,      2    ],    "children": [      {        "kind": "stack",        "panes": [          "panel-1",          "panel-2"        ],        "activePane": "panel-1"      },      {        "kind": "stack",        "panes": [          "panel-3"        ]      }    ]  },  "floating": []}

Source

<BsDockManager  layout={layout}  onLayoutChange={setLayout}  panes={PANE_OPTIONS}  pane={({ pane }) => CONTENT[pane]}/>

Tool windows and toolbars

A CAD-like shell. Toolbars live in trays along the edges (drag one by its dotted thumb, or out of every tray to float it); tool palettes get a caption and lay out in a column beside the drawing and in a row above or below it. The drawing cannot be moved or closed. The Windows buttons close a pane and reopen it where it stood.

Keyboard shortcuts
  • Enter / Space / M on a toolbar's thumb — arm toolbar move mode.
  • In toolbar move mode: T / B / L / R moves it to the top / bottom / left / right tray · ← / → along its row (↑ / ↓ in a side tray) · the other two arrows to the next row in or out · F floats it · Enter finishes · Esc puts it back.
  • Enter / Space / M on a palette's caption title — arm pane move mode, with the keys above.
  • Double-click a floating toolbar's caption to put it back in its tray.
const PANES: DockPanesOptions = {  drawing: { title: 'Drawing', chrome: 'none', closable: false, movable: false, floatable: false },  draw: { title: 'Draw', kind: 'tool', size: 'auto' },  standard: { title: 'Standard', kind: 'toolbar' },};<BsDockManager  layout={layout}  onLayoutChange={setLayout}  panes={PANES}  // 'vertical' beside the drawing, 'horizontal' above or below it, or floating  pane={({ pane, orientation }) => <MyPalette pane={pane} orientation={orientation} />}/>// A Windows menu: pure functions over the layout, in every framework.const toggle = (pane: string) =>  setLayout((layout) => isDockPaneOpen(layout, pane)    ? closeDockPane(layout, pane, PANES)    : openDockPane(layout, pane, PANES)); // back where it stood