How emilk/egui works
egui is a portable immediate-mode Rust GUI stack, with eframe providing app runtimes for native and web targets. The typical flow is app code building UI each frame, egui handling interaction and state, epaint shaping text and tessellating shapes, then a backend presenting output. The workspace also provides layout/math and color foundations, optional image and table extensions, inspection, and UI testing. Edges below are limited to README statements or visible module references/calls; several unsampled backend details are represented by their exact source directories.
Main entry points: context.rs UI context · text_layout.rs Shapes and text · lib.rs App framework · native Native runtime
Components 22
Immediate UI
- UI context
crates/egui/src/context.rs - Widgets
crates/egui/src/widgets - Layout containers
crates/egui/src/containers - Interaction response
crates/egui/src/response.rs - Input model
crates/egui/src/data/input
Paint and Render
- Shapes and text
crates/epaint/src/text/text_layout.rs - Mesh tessellation
crates/epaint/src/tessellator.rs - Glow renderer
crates/egui_glow/src/painter.rs - WGPU renderer
crates/egui-wgpu/src/renderer.rs
App Runtimes
- App framework
crates/eframe/src/lib.rs - Native runtime
crates/eframe/src/native - Web runtime
crates/eframe/src/web/app_runner.rs - Native input
crates/egui-winit/src/lib.rs - Browser input
crates/eframe/src/web/events.rs - Web persistence
crates/eframe/src/web/storage.rs
Extensions
- Images and tables
crates/egui_extras/src - UI inspection
crates/egui_inspection/src/plugin.rs - UI harness
crates/egui_kittest/src/lib.rs
Core Foundations
- 2D math
crates/emath/src/rect.rs - Color types
crates/ecolor/src/color32.rs
Other components
- App developer
- End user
Connections 26
- App developer → App framework: starts app
README.md - App developer → UI context: builds UI
README.md - App framework → Native runtime: runs natively
README.md - App framework → Web runtime: runs on web
README.md - Web runtime → Web persistence: persists memory
crates/eframe/src/web/storage.rs - Native input → Input model: translates events
crates/egui-winit/src/lib.rs - Browser input → Input model: supplies events
- App framework → UI context: calls app UI
README.md - UI context → Widgets: builds widgets
README.md - UI context → Layout containers: organizes UI
README.md - Widgets → Interaction response: reports interaction
crates/egui/src/widgets/drag_value.rs - Input model → UI context: drives interaction
README.md - UI context → Shapes and text: produces shapes
README.md - Shapes and text → Mesh tessellation: tessellates shapes
crates/epaint/src/tessellator.rs - Native runtime → Native input: handles platform
- Native runtime → WGPU renderer: renders frames
README.md - Web runtime → WGPU renderer: renders frames
- Native runtime → Glow renderer: renders frames
- Web runtime → Glow renderer: renders frames
- Shapes and text → Images and tables: supports images
README.md - UI context → UI inspection: exposes state
- UI harness → UI context: runs UI frames
crates/egui_kittest/src/lib.rs - UI context → 2D math: uses geometry
- Shapes and text → Color types: uses colors
- WGPU renderer → End user: presents UI
README.md - Glow renderer → End user: presents UI
README.md