Favicon of egui

egui

egui is a pure-Rust immediate mode GUI library for building web and native apps and adding UIs to game engines.

egui website screenshot
egui GitHub repository preview

egui (pronounced "e-gooey") is an immediate mode GUI library written in pure Rust. It targets developers who need a simple, portable way to add a graphical interface to a Rust application, whether that's a standalone desktop/web app or a debug overlay inside a game engine. Because it's immediate mode, there's no widget tree to manage, no callbacks, and no risk of GUI state drifting out of sync with app state.

egui doesn't assume anything about your platform or renderer. It just produces a mesh of textured triangles each frame, which means it can be wired into almost any rendering setup. The official eframe framework wraps this up for you, letting the same codebase compile to web (via Wasm), Linux, Mac, Windows, and Android.

Key features

  • Immediate mode API: no on-click handlers, no widget references to store; you draw and check interaction in the same line, e.g. if ui.button("Save").clicked() { save(file); }.
  • Cross-platform by design: the same Rust code runs as a native app and compiles to Wasm for the browser.
  • Zero unsafe code: egui forbids unsafe, and keeps its default dependency footprint small.
  • Built-in widget set: labels, buttons, sliders, checkboxes, radio buttons, color pickers, text editing with undo/copy-paste, images, and windows/panels with resizing and scrolling.
  • Renderer-agnostic core: egui itself doesn't touch the OS or GPU; integrations (via egui-wgpu, egui_glow, egui-winit) handle input, painting, and output.
  • Accessibility support: hooks into AccessKit for screen reader compatibility.
  • Extensible widgets: writing custom widgets is straightforward since egui is just a library you call into, not a framework you're locked into.
  • Modular crates: you can use small parts of egui (like the epaint 2D graphics API) independently and combine them as needed.

Ideal use cases

egui fits well when you're already writing something in Rust and need a functional GUI without a lot of ceremony: debug tools, editors, small utility apps, or a settings/inspector panel bolted onto a game engine. It's also a reasonable choice if you want to ship the same app to both a browser and a desktop binary without maintaining two UI codebases. Projects like the Rerun Viewer show it can support production-quality tools, not just prototypes.

It's not the right fit if you're not writing Rust, or if you need a UI that looks and behaves like a native OS widget set, since egui renders its own look rather than deferring to platform styling. It's also a weaker choice if API stability matters a lot right now; the project is under active development and breaking changes ship with new releases. Very large scrollable UIs with long scrollback content can also be slower, since layout happens every frame, though egui only repaints on interaction or animation so idle apps use no extra CPU.

Installation

For a quick native or web app, start from the official template instead of setting up integrations by hand:

git clone https://github.com/emilk/eframe_template/

Then follow the instructions in that repo to build and run it.

To add egui directly to an existing Rust project, add it as a dependency in Cargo.toml:

[dependencies]
egui = "*"
eframe = "*"

To load images, add the official extras crate:

egui_extras = "*"

If you want to try the web demo locally, run:

cargo run --release -p egui_demo_app

The native backend uses wgpu via the egui-wgpu crate and works out of the box on Mac and Windows. On Linux, install these dependencies first:

sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev

On Fedora Rawhide:

dnf install clang clang-devel clang-tools-extra libxkbcommon-devel pkg-config openssl-devel libxcb-devel gtk3-devel atk fontconfig-devel

These system packages are only needed for running the demo app; egui itself is platform agnostic and has no such requirements.

Frequently asked questions

Share:

Stars
29.8K
Forks
2.1K
Last commit
2 days ago
Repository age
8 years
License
Apache-2.0
Self-hosted
No
Activity score
83/100
View Repository
Ad
Favicon

 

  
 

Similar to egui

Favicon

 

  
 
Favicon

 

  
 
Favicon