Skip to main content

Crate egui_elements

Crate egui_elements 

Source
Expand description

Widgets, themes, and optional components for egui.

This crate is not a drop-in replacement for stock egui widgets. It ships a themed widget set, a palette of built-in looks, a live theme editor, and a few higher-level components (credentials form, QR image, Linux/Windows QR scanner).

There are no crate-root re-exports. Import from the modules:

use egui_elements::theme::{Theme, ThemeKind};
use egui_elements::widgets::{Button, ComboBox, Label, Modal, SecureTextEdit, Window};
use egui_elements::utils::theme_switcher;

§Quick start

use egui::{Context, Ui};
use egui_elements::theme::{Theme, ThemeKind};
use egui_elements::widgets::Button;

fn ui(ctx: &Context, ui: &mut Ui) {
    let mut theme = Theme::new(ThemeKind::TokyoNight);
    theme.install(ctx);

    if ui.add(Button::new("Save")).clicked() {
        // …
    }
}

Custom widgets pick up visuals from the installed Theme. You can still override a single widget with .visuals(...).

§Modules

§Features

FeatureWhat it enables
serdeSerialize / Deserialize on theme types; egui/serde
lucideegui-lucide SVG icons. Also enabled by secure-types and qr-scanner.
secure-typesSecureString buffers, credentials form, virtual keyboard
qr-imageEncode a string as a QR Image
qr-scannerLinux/Windows screen-capture QR scanner (xcap + rqrr-zeroize)
elegancePush the current palette into egui-elegance
fullAll of the above

Run the showcase with:

cargo run --example demo --features full

See the crate README for system packages required by qr-scanner.

ComboBox and Window have the same names as egui::ComboBox and egui::Window. Import this crate’s widgets after use egui::*, or alias one of them.

Re-exports§

pub use theme::Theme;
pub use theme::ThemeKind;
pub use widgets::Button;
pub use widgets::ComboBox;
pub use widgets::Frame;
pub use widgets::Label;
pub use widgets::Modal;
pub use widgets::MultiLabel;
pub use widgets::Window;

Modules§

components
Higher-level composites built on the themed widgets.
editor
Live theme editor window.
theme
Installed look: palette, typography, frames, and per-widget visuals.
themes
Built-in palettes.
utils
Helpers: theme switcher, HSLA colors, and interactive frames.
visuals
Per-widget visuals stored on Theme and optionally overridden on a single widget via .visuals(...).
widgets
Themed widgets that read visuals from an installed Theme.