RepoPilotOpen in app →

emilk/egui

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

Healthy

Healthy across the board

weakest axis
Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit today
  • 28+ active contributors
  • Apache-2.0 licensed
Show all 6 evidence items →
  • CI configured
  • Tests present
  • Concentrated ownership — top contributor handles 50% of recent commits

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/emilk/egui)](https://repopilot.app/r/emilk/egui)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/emilk/egui on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: emilk/egui

Generated by RepoPilot · 2026-05-09 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/emilk/egui shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across the board

  • Last commit today
  • 28+ active contributors
  • Apache-2.0 licensed
  • CI configured
  • Tests present
  • ⚠ Concentrated ownership — top contributor handles 50% of recent commits

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live emilk/egui repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/emilk/egui.

What it runs against: a local clone of emilk/egui — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in emilk/egui | Confirms the artifact applies here, not a fork | | 2 | License is still Apache-2.0 | Catches relicense before you depend on it | | 3 | Default branch main exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 30 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>emilk/egui</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of emilk/egui. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/emilk/egui.git
#   cd egui
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of emilk/egui and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "emilk/egui(\\.git)?\\b" \\
  && ok "origin remote is emilk/egui" \\
  || miss "origin remote is not emilk/egui (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(Apache-2\\.0)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"Apache-2\\.0\"" package.json 2>/dev/null) \\
  && ok "license is Apache-2.0" \\
  || miss "license drift — was Apache-2.0 at generation time"

# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
  && ok "default branch main exists" \\
  || miss "default branch main no longer exists"

# 4. Critical files exist
test -f "crates/egui/src" \\
  && ok "crates/egui/src" \\
  || miss "missing critical file: crates/egui/src"
test -f "crates/epaint/src" \\
  && ok "crates/epaint/src" \\
  || miss "missing critical file: crates/epaint/src"
test -f "crates/eframe/src/lib.rs" \\
  && ok "crates/eframe/src/lib.rs" \\
  || miss "missing critical file: crates/eframe/src/lib.rs"
test -f "crates/egui-winit/src/lib.rs" \\
  && ok "crates/egui-winit/src/lib.rs" \\
  || miss "missing critical file: crates/egui-winit/src/lib.rs"
test -f "crates/egui-wgpu/src/lib.rs" \\
  && ok "crates/egui-wgpu/src/lib.rs" \\
  || miss "missing critical file: crates/egui-wgpu/src/lib.rs"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 30 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~0d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/emilk/egui"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

egui is an immediate-mode GUI library written in pure Rust that renders to GPU-accelerated triangles, enabling the same UI code to run on web (via WebAssembly), native desktop (Linux/Mac/Windows), and game engines. It prioritizes ease-of-use and portability over traditional retained-mode GUI paradigms, with a minimal unsafe footprint and batteries-included framework (eframe) that handles windowing, rendering, and platform integration. Monorepo workspace (Cargo.toml at root) with 12 crates: crates/egui is the core immediate-mode library, crates/eframe wraps it with platform integration, crates/epaint handles 2D tessellation/rendering, crates/ecolor and crates/emath provide math primitives, and specialized rendering backends (egui_glow, egui-wgpu, egui-winit) for different graphics APIs. Examples live in examples/ folders within each crate.

👥Who it's for

Rust developers building cross-platform desktop and web applications who want to avoid boilerplate and platform-specific code; game developers integrating UIs into engines like Bevy or custom renderers; teams shipping both web and native versions of the same app with shared UI logic.

🌱Maturity & risk

Actively maintained and production-ready. The project is at version 0.34.2 with established CI/CD pipelines (20+ GitHub Actions workflows), Rust 1.92+ MSRV enforcement, MIT/Apache-2.0 dual licensing, and an active Discord community (900+ members visible in badge). However, the 0.x version number signals ongoing evolution rather than guaranteed API stability.

Low risk for new projects; the main dependencies (emath, ecolor, epaint) are tightly controlled within the workspace, and the codebase forbids unsafe code. Breaking changes are possible given pre-1.0 status, so pinning to 0.34.x in production is recommended. Single-maintainer risk is partially mitigated by community engagement, but watch CODEOWNERS for core module maintainers.

Active areas of work

Active CI enforcement (cargo_shear, typos, link_checker, png_only_on_lfs workflows), web demo deployment pipeline, and kittest snapshot testing. The CHANGELOG.md and RELEASES.md track versioning; recent work appears focused on stability and web demo polish given the deploy_web_demo and preview workflows.

🚀Get running

git clone https://github.com/emilk/egui
cd egui
cargo build
cargo run --example demo_app

For web, see eframe's README: cd crates/eframe && cargo build --target wasm32-unknown-unknown. The workspace uses resolver = "2" and is edition 2024.

Daily commands: Native: cargo run --example demo_app from workspace root or crate dir. Web: cd crates/eframe && wasm-pack build --target web examples/wasm_example (or use eframe's web helpers). Tests: cargo test --all runs unit tests; cargo test --doc for doc tests. Lint: cargo clippy (clippy.toml configured), cargo fmt --check, cargo shear (unused deps).

🗺️Map of the codebase

  • crates/egui/src — Core egui immediate-mode GUI library; all UI widgets and input handling originate here
  • crates/epaint/src — Painting/rendering abstraction layer that transforms egui's output into renderable primitives
  • crates/eframe/src/lib.rs — Application framework that bridges egui to native (winit/glow/wgpu) and web (wasm) platforms
  • crates/egui-winit/src/lib.rs — Input event translation layer that converts winit events into egui input context
  • crates/egui-wgpu/src/lib.rs — GPU-based rendering backend using WebGPU/wgpu for high-performance output on native and web
  • crates/ecolor/src/lib.rs — Color representation and manipulation; foundational for all visual styling in egui
  • Cargo.toml — Workspace root defining all crates, dependencies, and edition/MSRV constraints

🛠️How to make changes

Add a New UI Widget

  1. Define the widget struct in crates/egui/src/widgets/ with builder methods (crates/egui/src/widgets/mod.rs)
  2. Implement sense handling and response logic (mouse/keyboard interaction) (crates/egui/src/widgets/your_widget.rs)
  3. Add layout, sizing, and painting calls to Ui::your_widget() (crates/egui/src/ui.rs)
  4. Test the widget with a demo in crates/egui_demo_lib/src/ (crates/egui_demo_lib/src/apps/demo/widgets.rs)

Add Support for a New Rendering Backend

  1. Create crates/egui-myrenderer/ with Cargo.toml and src/lib.rs (crates/egui-wgpu/Cargo.toml)
  2. Implement Painter trait to convert epaint draw lists to your GPU API (crates/egui-wgpu/src/renderer.rs)
  3. Integrate with eframe's run_native() via feature flags and platform code (crates/eframe/src/native/mod.rs)
  4. Add example in examples/ that uses your backend (crates/eframe/examples)

Add a Web Feature (for Web Runtime)

  1. Add Wasm integration code in crates/eframe/src/web/ (crates/eframe/src/web/mod.rs)
  2. Define JavaScript bindings using wasm-bindgen (e.g., DOM access, storage) (crates/eframe/src/web/app_runner.rs)
  3. Update crates/eframe/src/lib.rs to conditionally compile web modules (crates/eframe/src/lib.rs)
  4. Test with cargo build --target wasm32-unknown-unknown and wasm-server-runner (Cargo.toml)

Customize Color & Styling

  1. Define a Visuals struct with color scheme in crates/egui/src/style/ (crates/egui/src/style/mod.rs)
  2. Use color palettes from crates/ecolor/src/color32.rs (crates/ecolor/src/color32.rs)
  3. Apply Visuals to Context via ctx.set_style() in your app's update() (crates/egui/src/context.rs)

🔧Why these technologies

  • Immediate-Mode GUI (IM GUI paradigm) — Simplifies reactive UI: no retained state tree needed; widget code is data-driven and runs every frame. Perfect for real-time applications, games, and tools.
  • Rust + no-unsafe-by-default — Memory safety without GC; zero-cost abstractions; fearless concurrency; Badge: 'unsafe forbidden' signals security-conscious design
  • wgpu (WebGPU Rust bindings) — Cross-platform GPU abstraction: runs on Metal (macOS), Vulkan (Linux), DX12 (Windows), and WebGPU (browser). Single rendering code for native and web.
  • winit (window & event loop) — Mature cross-platform windowing library; abstracts OS event loops, input handling, and window management (Windows, macOS, Linux, web).
  • wasm (Rust to WASM compilation) — Allows the same egui app to run unmodified in browsers without JavaScript. No separate web codebase needed.

⚖️Trade-offs already made

  • Immediate-mode architecture (redraw every frame)

    • Why: Simplicity: UI logic is stateless; avoids complex diff/reconciliation logic. No prop drilling or complex state management.
    • Consequence: Higher per-frame CPU cost (must re-run all widget code); must optimize hot paths. Not suitable for UIs with thousands of widgets on low-end devices.
  • Single cross-platform render pipeline (wgpu) rather than native APIs

    • Why: Code reuse; unified feature set across platforms; easier maintenance.
    • Consequence: Cannot exploit platform-specific GPU optimizations; potential performance penalty vs. hand-tuned Metal/DX12; depends on wgpu's maturity.
  • No built-in networking, persistence, or backend integration

    • Why: Keep egui focused on UI concerns; let users integrate databases, HTTP clients, async runtimes separately.
    • Consequence: Apps must wire up their own data layer; more boilerplate for data-heavy apps.
  • Browser rendering via WASM + WebGPU (not WebGL

    • Why: undefined
    • Consequence: undefined

🪤Traps & gotchas

Wasm optimization: Release profile uses opt-level = 2 by default (not 3) to reduce binary size; don't override without testing. Debug backtrace feature: Dev builds intentionally don't use panic = "abort" to preserve backtrace support for the debug introspection feature (all modifiers + hover). Unsafe forbidden: The codebase enforces zero unsafe via CI; any unsafe blocks will be rejected. Minimal MSRV: Rust 1.92+ is the floor; feature-gating may be needed for older toolchains. Platform-specific backends: Ensure correct backend crate is enabled (egui_glow for OpenGL, egui-wgpu for WebGPU); mismatches cause link errors.

🏗️Architecture

💡Concepts to learn

  • Immediate Mode GUI — egui's entire architecture is built on this paradigm: UI is described in code each frame without retained state trees, making cross-platform code trivial and debugging straightforward.
  • GPU Tessellation — epaint converts 2D shapes and text into triangle meshes and clip rectangles for GPU rendering; understanding tessellation is key to extending egui's rendering or optimizing for custom hardware.
  • WebAssembly (WASM) — egui's web deployment compiles Rust to WASM via wasm32-unknown-unknown target; binaries are optimized via cargo profile tuning for size and speed.
  • Graphics API Abstraction — egui decouples logic from rendering backends (wgpu, glow, custom); adding a new backend requires implementing a thin trait in a new crate like egui_glow.
  • MSRV (Minimum Supported Rust Version) — egui enforces Rust 1.92+ via CI; this affects which language features and dependencies can be used, important for library compatibility guarantees.
  • Monorepo Workspace — Cargo workspaces with resolver = "2" enable shared dependencies and coordinated versioning across 12 tightly-coupled crates; crucial for understanding how to modify and test changes.
  • Unsafe-free Code — egui forbids unsafe via CI enforcement; this adds performance constraints and influences the choice of algorithms and dependencies, differentiating it from lower-level graphics libraries.
  • bevyengine/bevy — Popular ECS game engine with egui integration via bevy_egui; primary consumer of egui for in-game UI.
  • iced-rs/iced — Alternative Elm-inspired GUI library for Rust (retained-mode, not immediate-mode); different philosophy but same ecosystem.
  • fltk-rs/fltk-rs — Bindings to FLTK C++ library; traditional GUI toolkit alternative for Rust desktop apps without web support.
  • DioxusLabs/dioxus — React-like declarative UI framework for Rust web/desktop; complementary approach to egui's immediate mode.
  • rust-windowing/winit — Lower-level window/input abstraction that egui-winit wraps; powers all egui native platform support.

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive unit tests for ecolor color conversion functions

The ecolor crate (crates/ecolor/src) contains critical color manipulation functions (color32.rs, hsva.rs, hsva_gamma.rs, rgba.rs) but lacks visible unit test coverage. Color conversions are mathematically sensitive and prone to edge-case bugs (especially around gamma correction and HSV<->RGB conversions). Adding thorough tests would improve reliability for web/native rendering.

  • [ ] Create crates/ecolor/src/tests/ directory with test modules for each file
  • [ ] Add tests for Color32 conversions (sRGB to linear, gamma handling)
  • [ ] Add tests for HSVA<->RGBA round-trip conversions with boundary values (0, 255, NaN)
  • [ ] Add tests for hsva_gamma conversions to verify gamma correction accuracy
  • [ ] Verify tests run in CI by checking .github/workflows/rust.yml includes ecolor tests

Add CI workflow for checking breaking changes in public APIs

The repo uses workspace versioning (0.34.2) and has strict maintenance practices (CODEOWNERS, CONTRIBUTING.md), but lacks automated detection of semver-breaking API changes. With multiple public crates (egui, eframe, epaint, ecolor, emath), accidental breaking changes could slip through. A cargo-semver-checks workflow would prevent this.

  • [ ] Create .github/workflows/semver_check.yml using cargo-semver-checks action
  • [ ] Configure it to check only public crates listed in workspace members (egui, eframe, epaint, ecolor, emath)
  • [ ] Set baseline version from Cargo.toml workspace.package.version (0.34.2)
  • [ ] Add required: true status check in branch protection rules
  • [ ] Document the workflow in CONTRIBUTING.md with guidance on addressing failures

Add platform-specific integration tests for native event loop and rendering

The crates/eframe/src/native directory contains complex platform-specific code (macos.rs, winit_integration.rs, glow_integration.rs, wgpu_integration.rs) but tests directory structure suggests minimal platform-specific test coverage. Adding integration tests for window creation, event handling, and renderer initialization would catch regressions across backends.

  • [ ] Create tests/native_integration/ with test suite for eframe native backend
  • [ ] Add tests for window creation with different configurations (size, position, icons from crates/eframe/data/icon.png)
  • [ ] Add tests for event loop context (crates/eframe/src/native/event_loop_context.rs) with mock events
  • [ ] Add renderer initialization tests for both glow and wgpu backends (glow_integration.rs, wgpu_integration.rs)
  • [ ] Configure tests to run on multiple platforms in CI (ubuntu, macos, windows) in rust.yml workflow

🌿Good first issues

  • Add unit tests to crates/ecolor/src/hsva.rs and crates/ecolor/src/hsva_gamma.rs for color space conversion edge cases (currently coverage gaps visible in file list).
  • Document the widget builder pattern with a detailed guide in ARCHITECTURE.md; add inline examples to crates/egui/src/widgets/ for each widget type.
  • Implement missing accessibility labels for custom widgets; audit crates/egui/src/widgets/ for missing id() and label() calls and add them systematically.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • e3d7a01 — Bump version to 0.34.2 and update changelogs (#8147) (lucasmerlin)
  • e9b8c0d — Fix text layout bugs in wrapped texts (#8137) (lucasmerlin)
  • fe8b1ed — Android example: document pre-requisites and fix code for rust 1.92.0 (#8122) (skorobogatydmitry)
  • 8a0855b — Update rustls-webpki (emilk)
  • 56aabda — Add Harness::spawn_eframe_app (#8120) (emilk)
  • d7e55b8 — Group glow config in a struct (#8108) (TapGhoul)
  • f342ab8 — wgpu: Allow configuring VSync and frame latency at runtime (#8114) (emilk)
  • 4610b7c — Don't hide whitespaces in centered and right aligned text edits (#8102) (lucasmerlin)
  • d5616c5 — Update rustls-webpki and rustls (#8107) (emilk)
  • fef2692 — Fix grapheme cluster glyph count to restore cursor/selection invariant (#8088) (gcailly)

🔒Security observations

The egui codebase demonstrates generally good security practices with a dual-license approach (MIT/Apache-2.0), safety-first design goals, and organized workspace structure. However, there are areas requiring attention: (1) Web/WASM security hardening is critical for applications using the web backend; (2) Unsafe code usage claims need verification across all crates, especially graphics and native integration layers; (3) The incomplete dependency definition in Cargo.toml needs completion and audit. The use of modern Rust edition and recommended optimization settings are positive security indicators. No hardcoded secrets, SQL injection risks, or obvious configuration vulnerabilities were detected in the provided file structure.

  • Low · Incomplete Workspace Dependencies Definition — Cargo.toml - [workspace.dependencies] section. The workspace dependencies section in Cargo.toml appears to be truncated (ends with 'epai' without completion). This could indicate incomplete dependency management or potential supply chain risks if dependencies are not properly defined. Fix: Complete the workspace dependencies definition and ensure all transitive dependencies are properly reviewed and pinned to secure versions.
  • Low · Unsafe Code Usage Despite Safety Claims — Multiple crates - particularly crates/eframe/src/native and crates/egui-wgpu/src. The README claims 'unsafe forbidden' badge, but this is a code-level claim that should be verified across all crates in the workspace (eframe, egui-wgpu, egui-winit, etc.), especially the native/graphics integration layers which may require unsafe code. Fix: Verify through code review or static analysis tools (cargo-deny, cargo-audit) that unsafe code is minimized and properly reviewed in graphics, windowing, and native system integration code.
  • Medium · Web-Based Application Security Concerns — crates/eframe/src/web/. The codebase includes Web/WASM support (crates/eframe/src/web/) which can introduce XSS and other web security vulnerabilities. Web implementations need additional security hardening compared to native applications. Fix: Implement Content Security Policy (CSP) headers, validate all user inputs, sanitize any HTML output, and regularly audit web-specific code paths. Use security-focused testing for web deployments.
  • Low · Rust Edition 2024 Compatibility — Cargo.toml - [workspace.package] edition field. The workspace targets edition = '2024', which is a very recent edition. While not a direct security issue, it may have fewer community security reviews and unknown compatibility issues with dependencies. Fix: Monitor the Rust 2024 edition for any security advisories and maintain updated dependencies. Consider LTS stability vs. cutting-edge features trade-off.
  • Low · Panic Behavior Set to Abort in Release — Cargo.toml - [profile.release] and [profile.dev]. The release profile sets panic = 'abort' which is good for security (no unwinding), but the dev profile does not. This could mask security issues during development. Fix: Consider consistent panic behavior or ensure security testing is performed with release profile settings. Document why dev uses unwinding panic strategy.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.