Introduction
egui-workbench is a Rust library for building desktop applications with the visual language of an IDE: a custom title bar, menus, document tabs, an explorer, status bars, dialogs, a command palette, and a theme system. It is built on egui 0.37 and eframe from crates.io, with no forks or patches.
The crate is the shell, not the content. The model, the file format, the editor, and the renderer stay in your application. That boundary is what makes the shell reusable: a Markdown editor, a log viewer, a data tool, and a plot dashboard can share every pixel of chrome and nothing of their domain.
What you get
- Window and chrome. An undecorated window with resize edges, a 34 pt title bar with text menus and window controls, a document tab strip, a status bar, and an explorer.
- Optional panels. A resizable inspector on the right and output/terminal panel at the bottom, both responsive on narrow windows.
- Components. A shadcn-style builder layer: buttons, icon buttons, text fields, text areas, switches, checkboxes, selects, steppers, segmented controls, labels, badges, banners, cards, separators, menus, popovers, tab strips, trees, palettes, dialogs, toasts, and an icon grid.
- Charts. Interactive 2D and 3D plots with series, axes, fits, selection, live windows, SVG/PNG export, pie/donut, candlesticks, heatmaps, radar, gauges, waterfalls, 13 legend hover animations, and a streaming direction arrow.
Plot3Dadds an orbit camera, surfaces, and 3D bars. - Data viewer. Excel workbooks with sheet tabs, CSV/TSV, and virtualized plain-text reading through
components::viewer::FileViewer. - A runtime.
ThemeState,Documents<T>,Keymap<C>,CloseGuard, andshow_workbenchimplement the plumbing every workbench repeats. - Assets. 2,410 Lucide icons and the VS Code Material file/folder icon set, resolved by name through one tinted texture cache.
- Nine themes. GitHub Light, GitHub Dark, GitHub Dark Dimmed, Dracula, Dracula Soft, Alucard, One Dark Pro, One Dark Pro Darker, and One Dark Pro Light.
Live demo
What it is not
- Not a framework. There is no virtual DOM, no retained widget tree, and no hidden component state. egui is immediate mode; components receive state every frame.
- Not an editor. The crate has no editor format, syntax highlighter, or document renderer. The starter's editor is a
TextEditand its preview is plain text. The data viewer reads tabular files, but it is a viewer, not a spreadsheet editor. - Not a storage layer.
apphas no I/O and picks no config format. The template shows one settings implementation you can replace. - Not opinionated about commands.
Commandis your enum.PaletteItem<T>,MenuGroup<T>,TreeNode<K>,Keymap<C>, andDocuments<T>are generic over it.
Core principles
- The shell owns presentation only. Components take translated strings and state snapshots, and return events. File operations, persistence, and lifecycle decisions belong to the application.
- One
Commandenum, one handler. Menus, the command palette, the keyboard menu, shortcuts, and panel buttons produce the same command. Every action is reachable by pointer, keyboard, and search. - No literal colors or sizes. Colors come from
themetokens or egui visuals; chrome sizes come frommetrics. The two documented exceptions are the red close-button hover and the white icon tint. - Accessible by construction. Every custom-painted widget declares an AccessKit role and name. Contrast follows WCAG 2.2 AA, and the tests enforce it.
- No idle repaint. The UI repaints on input, animation, or an explicit wake from a worker.
A frame in the runtime
eframe 0.37 splits each frame into logic and ui:
App::logicsyncs the theme, checks the close guard, updates the window title, and consumes a shortcut when no modal is open.App::uicallsshow_workbench, which draws the panels in a fixed order and collects oneVec<Command>.- The application applies every command in a single
handlefunction. - Toasts and other overlays are painted last, above the shell.
rust
impl eframe::App for App {
fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
self.theme.sync_system(ctx);
if self.guard.should_prompt(ctx, self.docs.any_dirty()) {
self.close_prompt = true;
}
}
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
let ctx = ui.ctx().clone();
for command in show_workbench(ui, self) {
self.handle(&ctx, command);
}
}
}Next steps
- Try the real component catalog in the browser: Live demo is the same Rust app compiled to WebAssembly.
- Install the crate: one line in
Cargo.toml. - Generate a working application with Quick start.
- Learn the contract in Core concepts, then browse the component reference.