egui_stack: docking for egui
egui_stack is a docking and window-layout system for egui: a window's whole space as a tree of zones (side
areas, a centre, toolbars), tabs in splits, rows, columns and grids inside them, folding and collapsing zones, floating
windows, and collapsible sections stacked in a panel.
Try it in your browser: the demo (demo/), built for the web
from this repository's main branch.

Features
Docking
- Tabs in splits, rows, columns and n-ary grids; opening, closing, moving and resizing them.
- Drop zones drawn on the target (a border and a light tint), with an edge band to split and a band under the tab bar to join; a tab lands where it is released.
- Dragging a single tab, or a whole tab group by a grip at the end of its tab bar, the empty part of the bar, a tab
dragged with Shift held, or "Move group" in its menu, each handle switchable (
GroupHandles); a drag starts only past an activation distance. - Floating windows split gestures by where a drag starts: a tab, the group grip (or Shift), or a move handle at the
end of the top tab bar that moves the window, with the move cursor (a float over the main window has no title bar of
its own unless
FloatsArea::title_barasks for one); moving a window only moves it, or docks it whole as in Visual Studio withFloatMove::Dock. - Floating docks for tabs and groups dragged out: over the main window, or in native windows of their own (egui
viewports the application hosts through
ViewportHost), drawn byFloatsArea; closing one returns its tabs where they came from, or asClosePolicysays, and windows left off every screen are brought back (docs/native-floats.md). - A work area for the floats over the main window (
FloatsArea::work_area): regions made of the space, layout zones or rects, resolved every frame; a float stays in one region, moved from one to the next without straddling a gap, never larger than it, brought back when its region shrinks or goes; a tab released outside every region stays where it was, or, withOutside::Native, a tab or a float released past the edge becomes a native window there (docs/dock-space.md). - One drag across native windows (
DockSpace::dragging): a tab or a group goes from the main window to a float, back, or from float to float, with the same drop zones, veto and Escape, across screens of different scales; where the system hides window positions (Wayland), the windows that could take it are outlined. - Several docks sharing one drag (
DockSpace): side areas and a centre, each drawn where the application puts it, with no-drop zones (a toolbar, a status bar) where a released tab goes back instead of floating. - A veto on every drop (
dock_drop_allowed), and full control of the layout from code.
Window layout (docs/layout-and-dock.md)
layout::Layout: the window as a tree of zones with constraints (least, largest and default sizes in points or shares), drawn byLayoutArea, with sashes that snap and resize from the keyboard.- Folding a zone to a strip, with a grip, the app's icons and an optional built-in title (
LayoutStyle::strip_title, orZoneViewer::strip_titleto draw it yourself); a click unfolds, a drag on the strip's edge pulls it out. - Zones that fold by themselves for want of room (
Constraints::auto_fold), reported asLayoutEvents; a click on their strip opens them over their neighbour until closed (ZoneViewer::on_stripto change what a strip does). - Strips that take dropped tabs (
Constraints::strip_drops), and empty docks that collapse to nothing (Fold::Collapse) and come back from a restore band while a tab is dragged. - Zones lying over their neighbour and a flyout, with their own dismiss rules.
Docked: aLayoutand itsDockSpacesaved and repaired as one value (serdefeature), floats included.- An optional
busfeature declaring egui_stack's points (stack.dock.drop,stack.layout.changed,stack.window.*) on an application's bus-contract bus.
Sections
- Collapsible sections stacked in a panel (
sections::Sections): fold, resize, pull as a block, size by content or share, remembered by name.
Look and access
- A
Style, or aDockPainter/LayoutPainterthat paints tabs, tab bars, bodies, separators, strips, sashes and drop overlays itself. - Every separator, sash, grip and strip is named for screen readers (
Labels), and reachable from the keyboard.
Quick start
Add egui and egui_stack to your project's dependencies:
[]
= "0.37"
= "0.32"
Then proceed by setting up egui, following its quick start guide. Once
that's done, you can start using egui_stack; its documentation builds with cargo doc --open.
Examples
The Git repository of this crate contains some example applications demonstrating how to achieve certain effects. You
can find all of them in the demo/examples folder.
You can run them with Cargo from the crate's root directory, for example: cargo run -p egui_stack_demo --example hello.
cargo run -p egui_stack_demo --example wgpu_float shows a detached 3D viewport: a tab rendering its own wgpu scene moves into a native
floating window the application hosts (docs/native-floats.md, "Using native floats").
Demo
The demo, a separate crate in demo/, runs natively with cargo run -p egui_stack_demo and in the browser:
demo/build-web.sh builds it into demo/dist. The online demo
is rebuilt on each push to the main branch.
Its Inspect button (Ctrl+Shift+F12) picks a part of the dock (a tab, a tab bar, a body, a separator) and says what it is
and which Style fields drew it, with a Copy button for bug reports; a second view holds egui's own inspection.
On both its pages, One dock and Dock space, a tab or a group dragged out of every dock opens a FloatsArea float, moved
by the handle at the right end of its top tab bar; the toolbar's Floats choice opens the next ones natively (not in the
browser).
History and credits
egui_stack continues egui_dock: a docking system for egui, originally
created by @lain-dono and developed for years by
Adam Gąsior (@Adanos020), later maintained by @anhosh, with
many contributors. Its full history is kept here, so every commit keeps its author. Thanks to all of them.
It is a divergent fork: the API starts as egui_dock 0.21.1's, moved to egui 0.37, and will grow to hold more of an
application's panel management (stackable sections, toolbars). See NOTICE and the
changelog.
What differs from egui_dock:
- The crate is
egui_stack;use egui_dock::becomesuse egui_stack::. - egui 0.37.
- No particular policy on AI-assisted contributions: they are reviewed like any other, under the same rules (see CONTRIBUTING.md).