hello_egui

repository·main·Indexed 20 days ago

https://github.com/lucasmerlin/hello_egui

A collection of specialized utility crates for the egui library. Includes egui_dnd for drag-and-drop, egui_flex for a single-pass flexbox layout system, egui_form for form validation using garde or validator, egui_inbox for async message passing to views, egui_infinite_scroll for virtualized infinite lists, and egui_material_icons for Material Symbols integration.

Tokens
38.5K
Snippets
131
Records
181
Agent score
68%

What's inside hello_egui

  1. Overview of Experimental egui crates

    main

    The following crates are experimental. Use them with caution. If you need an experimental crate released to crates.io, please open an issue in the repository.

    • egui_animation: Animation utilities for egui. Used internally by egui_dnd.
    • egui_taffy: An experiment to add flexbox layout to egui using taffy. (Note: This has been developed into a standalone crate by @PPakalns).
    • egui_webview: WebView widget for egui based on wry. Warning: Currently uses unsafe to bypass Send/Sync limitations; may have safety issues. Currently unreleased.
    • perfect_cursors: A Rust port of Steve Ruiz's perfect cursors. Independent of egui but includes an egui example.
    • hello_egui_utils: Internal collection of utilities used by other crates.
  2. Overview of egui_webview

    main

    egui_webview is a proof-of-concept crate designed to integrate a webview into an egui application.

    How it works: Instead of direct embedding, it functions by taking screenshots of the webview and rendering those screenshots as an egui texture. This rendering occurs whenever content is displayed above the webview layer.

    Requirements: This implementation relies on a specific feature in the wry crate (specifically the screenshot PR: https://github.com/tauri-apps/wry/pull/266) to capture the webview content.

  3. Overview of Mature egui crates

    main

    The following crates are considered mature and are released on crates.io:

    • egui_dnd: Drag & drop sorting library for egui.
    • egui_flex: Flexbox layout for egui.
    • egui_inbox: Utility for sending messages to egui UIs from other threads or async functions.
    • egui_virtual_list: Flexible virtual scroll widget supporting dynamic heights and complex layouts. Compatible with egui_dnd.
    • egui_infinite_scroll: Infinite scroll functionality built on top of egui_virtual_list.
    • egui_router: A Single Page Application (SPA) router for egui with transition support.
    • egui_form: Form validation for egui.
    • egui_pull_to_refresh: Adds pull-to-refresh functionality to egui.
    • egui_suspense: Helper to display loading, error, and retry UIs while waiting for asynchronous data.
    • egui_thumbhash: Integration for using thumbhashes in egui.
    • egui_material_icons: Material icons for egui.
  4. Use egui_infinite_scroll for infinite scrolling lists

    main

    egui_infinite_scroll is a widget for egui that enables infinite scrolling functionality. It supports loading items with varying heights and allows scrolling to load content from either the top or the bottom of a list. It is built on top of the egui_virtual_list crate to provide efficient virtualized rendering.

    For practical implementations, refer to the Gallery and Chat examples in the hello_egui project.

  5. Add form validation to egui with egui_form

    main

    The egui_form crate provides form validation capabilities for egui applications. It supports two primary validation engines:

    • garde: Recommended for small or prototype projects because it includes built-in error messages. It is noted as being cleaner and more active.
    • validator: Recommended for larger projects that require internationalization (i18n), as it allows for custom error messages.

    Because these are standard Rust crates, you can share the same validation logic between your client (egui) and your server.

    If you use a different validation crate, you can still use egui_form by implementing the EguiValidationReport trait for your validation result.

  6. Use egui_virtual_list for advanced virtualized lists

    main

    The egui_virtual_list crate provides an enhanced virtual list widget for egui. While egui's built-in ScrollArea::show_rows provides basic virtualization, egui_virtual_list is designed for more complex scenarios including:

    • Variable Item Heights: Supports items with different heights. Heights are calculated lazily and cached as the user scrolls.
    • Custom Layouts: Allows placing multiple items within a single row.
    • Stable Scroll Position on Prepend: Supports adding items to the top of the list (e.g., in a chat interface) without shifting the current scroll position.

    When NOT to use this crate:

    • If you need to support extremely large datasets (1,000,000+ items) with instant jumping/seeking to any index, use the built-in egui::ScrollArea instead.
    • If you need horizontal scrolling (not yet supported).
    • If you want to implement an infinite scroll pattern, use the egui_infinite_scroll crate instead.