dockviewers
🌐 Live demo — no setup, runs in the browser.
A tiling/docking layout for Dioxus and Leptos — the IDE/trading-terminal kind: panes split, resize, tab together, float, and maximize, with the arrangement cached per screen size and restored on reload.
A random fuzz run (seed 172), not a demo. For the real thing, play with it.
// generate it yourself: nix run .#film.
Usage
Hand PackedArea a Signal of DockPanels (id + title + the content to render); the library owns layout, you own content.
use *;
use ;
Runnable demo: dx serve --example insilico --package dockviewers_dioxus --platform web — or open the hosted demo, no local setup needed. The Leptos binding is the same component with Arc<dyn Fn(PackedApi) + Send + Sync> in place of Callback — see examples/insilico_leptos.
Props: panels (order = stable overlay render order — don't reorder it, that remounts panels), on_band (see below), config.
Bands and the seed cache. A container width classifies into one of three Bands — sm/md/xl — each keeping its own arrangement, because a phone doesn't want a desktop's tiling. Set Config::storage_key and the framework caches the layout in localStorage under <key>-<band> on Alt+S, restoring it before your code runs. on_band fires once per band entry — at mount, and again on every crossing — after that resolution:
api.restored()⇒ the cache had a layout and the grid is already populated; walkapi.tab_ids()to rebuild your panel list from the ids it holds.- otherwise the grid is empty and it's yours to fill:
placeyour tiles, orloada default you fetched yourself.
A cached payload that is corrupt, from a future schema, or empty counts as a miss and says so on the console — never a silent reset. Persistence is wasm-only (a no-op natively, so every band reports a miss).
Publishing a default. The framework never talks to a server. Alt+Shift+S hands Config::on_save a Saved::Published { band, json } and does nothing else; persist it wherever you like (behind your own authorization) to become the default fresh clients load in on_band. Alt+S fires the same hook with Saved::Cached { band }, for feedback — the write already happened.
Scripting — PackedApi arrives through on_band; stash it in a signal to drive the dock from elsewhere. Every method is a read/write of the one state cell:
let gid = api.mint_group_id;
api.place; // auto-packs left-to-right, top-to-bottom
api.add_tab;
api.close_active;
api.resize;
api.reset; // wipe the layout back to empty
let json = api.save; api.load?; // `load` errors on corrupt/future JSON
api.cols; api.band; api.tab_ids;
Keybinds (Config::keybinds, all rebindable; ? lists the live set): u/U undo/redo, Backspace closes the focused pane, f maximizes it, d inspects the tile under the cursor, Alt+S caches, Alt+Shift+S publishes. None fire while an editable field has focus. Config::actions takes your own (Keybind, Rc<dyn Fn(&mut PackedState)>) pairs.
Grid — Config::steps (default 64) is the desktop column count, scaled down per band so the physical step stays ~constant and tiles reflow instead of shrinking; rows (default 36) is fixed.
Theming — only structural CSS ships; set --dv-* custom properties on any ancestor for colors/sizes (--dv-accent, --dv-fg, --dv-group-bg, --dv-tab-bg, --dv-tab-active-bg, --dv-tab-active-fg, --dv-tab-border, --dv-tabstrip-bg, --dv-resize-bg, --dv-shadow-bg, --dv-content-pad).