SkillAgentSearch skills...

Egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native

Install / Use

/learn @emilk/Egui
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

🖌 egui: an easy-to-use GUI in pure Rust

<img alt="github" src="https://img.shields.io/badge/github-emilk/egui-8da0cb?logo=github" height="20"> Latest version Documentation unsafe forbidden Build Status MIT Apache Discord

<br/> <div align="center"> <a href="https://www.egui.rs/"><img src="https://github.com/user-attachments/assets/cfaf1d43-9338-490f-ae82-99b420baa1b0" width="400"></a> <br/>

👉 Click to run the web demo 👈

</div>

egui (pronounced "e-gooey") is a simple, fast, and highly portable immediate mode GUI library for Rust. egui runs on the web, natively, and in your favorite game engine.

egui aims to be the easiest-to-use Rust GUI library, and the simplest way to make a web app in Rust.

egui can be used anywhere you can draw textured triangles, which means you can easily integrate it into your game engine of choice.

eframe is the official egui framework, which supports writing apps for Web, Linux, Mac, Windows, and Android.

Example

ui.heading("My egui Application");
ui.horizontal(|ui| {
    ui.label("Your name: ");
    ui.text_edit_singleline(&mut name);
});
ui.add(egui::Slider::new(&mut age, 0..=120).text("age"));
if ui.button("Increment").clicked() {
    age += 1;
}
ui.label(format!("Hello '{name}', age {age}"));
ui.image(egui::include_image!("ferris.png"));

<img alt="Dark mode" src="https://github.com/user-attachments/assets/3b446d29-99d8-4c82-86bb-4d8ef0516017">     <img alt="Light mode" src="https://github.com/user-attachments/assets/a5e7da93-89a8-4ba0-86b8-0fa2228a4f62" height="278">

Sections:

(egui 的中文翻译文档 / chinese translation)

Quick start

There are simple examples in the examples/ folder. If you want to write a web app, then go to https://github.com/emilk/eframe_template/ and follow the instructions. The official docs are at https://docs.rs/egui. For inspiration and more examples, check out the the egui web demo and follow the links in it to its source code.

If you want to integrate egui into an existing engine, go to the Integrations section.

If you have questions, use GitHub Discussions. There is also an egui discord server. If you want to contribute to egui, please read the Contributing Guidelines.

Demo

Click to run egui web demo (works in any browser with Wasm and WebGL support). Uses eframe.

To test the demo app locally, run cargo run --release -p egui_demo_app.

The native backend is egui-wgpu (using wgpu) and should work out-of-the-box on Mac and Windows, but on Linux you need to first run:

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 you need to run:

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

NOTE: This is just for the demo app - egui itself is completely platform agnostic!

Goals

  • The easiest to use GUI library
  • Responsive: target 60 Hz in debug build
  • Friendly: difficult to make mistakes, and shouldn't panic
  • Portable: the same code works on the web and as a native app
  • Easy to integrate into any environment
  • A simple 2D graphics API for custom painting (epaint).
  • Pure immediate mode: no callbacks
  • Extensible: easy to write your own widgets for egui
  • Modular: You should be able to use small parts of egui and combine them in new ways
  • Safe: there is no unsafe code in egui
  • Minimal dependencies

egui is not a framework. egui is a library you call into, not an environment you program for.

NOTE: egui does not claim to have reached all these goals yet! egui is still work in progress.

Non-goals

  • Become the most powerful GUI library
  • Native looking interface

State

egui is in active development. It works well for what it does, but it lacks many features and the interfaces are still in flux. New releases will have breaking changes.

Still, egui can be used to create professional looking applications, like the Rerun Viewer.

Features

  • Widgets: label, text button, hyperlink, checkbox, radio button, slider, draggable value, text editing, color picker, spinner
  • Images
  • Layouts: horizontal, vertical, columns, automatic wrapping
  • Text editing: multiline, copy/paste, undo, emoji supports
  • Windows: move, resize, name, minimize and close. Automatically sized and positioned.
  • Regions: resizing, vertical scrolling, collapsing headers (sections), panels
  • Rendering: Anti-aliased rendering of lines, circles, text and convex polygons.
  • Tooltips on hover
  • Accessibility via AccessKit
  • Label text selection
  • And more!

Check out the 3rd party egui crates wiki for even more widgets and features, maintained by the community.

<img src="https://github.com/user-attachments/assets/13e73b76-e456-42bd-8ec9-220802834268" width="50%">

Light Theme:

<img src="https://github.com/user-attachments/assets/2e38972c-a444-4894-b32f-47a2719cf369" width="50%">

Dependencies

egui has a minimal set of default dependencies. Heavier dependencies are kept out of egui, even as opt-in. All code in egui is Wasm-friendly (even outside a browser).

To load images into egui you can use the official egui_extras crate.

eframe on the other hand has a lot of dependencies, including winit, image, graphics crates, clipboard crates, etc,

Who is egui for?

egui aims to be the best choice when you want a simple way to create a GUI, or you want to add a GUI to a game engine.

If you are not using Rust, egui is not for you. If you want a GUI that looks native, egui is not for you. If you want something that doesn't break when you upgrade it, egui isn't for you (yet).

But if you are writing something interactive in Rust that needs a simple GUI, egui may be for you.

Integrations

egui is built to be easy to integrate into any existing game engine or platform you are working on. egui itself doesn't know or care on what OS it is running or how to render things to the screen - that is the job of the egui integration.

An integration needs to do the following each frame:

  • Input: Gather input (mouse, touches, keyboard, screen size, etc) and give it to egui
  • Call into the application GUI code
  • Output: Handle egui output (cursor changes, paste, texture allocations, …)
  • Painting: Render the triangle mesh egui produces (see OpenGL example)

Official integrations

These are the official egui integrations:

  • eframe for compiling the same app to web/wasm and desktop/native. Uses egui-winit and egui_glow or egui-wgpu
  • egui_glow for rendering egui with glow on native and web, and for making native apps
  • egui-wgpu for wgpu (WebGPU API)
  • egui-winit for integrating with winit

3rd party integrations

Check the wiki to find 3rd party integrations and egui crates.

Writing your own egui integration

Missing an integration for the thing you're working on? Create one, it's easy! See https://docs.rs/egui/latest/egui/#integrating-with-egui.

Why immediate mode

egui is an immediate mode GUI library, as opposed to a retained mode GUI library. The difference between retained mode and immediate mode is best illustrated with the example of a button: In a retained GUI you create a button, add it to some UI and install some on-click handler (callback). T

Related Skills

View on GitHub
GitHub Stars28.6k
CategoryDevelopment
Updated4h ago
Forks2.0k

Languages

Rust

Security Score

100/100

Audited on Mar 31, 2026

No findings