| Crates.io | microui-redux |
| lib.rs | microui-redux |
| version | 0.4.1 |
| created_at | 2024-01-02 04:27:44.67446+00 |
| updated_at | 2025-12-27 03:00:01.891613+00 |
| description | Idiomatic Rust MicroUI (immediate mode GUI) library port |
| homepage | |
| repository | https://github.com/NeoCogi/microui-redux |
| max_upload_size | |
| id | 1085785 |
| size | 3,655,432 |
This project started as a C2Rust conversion of Rxi's MicroUI and has since grown into a Rust-first UI toolkit. It preserves the immediate-mode feel while using stateful widget structs with stable IDs, a row/column layout helper API, and backend-agnostic rendering hooks.
Compared to microui-rs, this crate embraces std types, closure-based window/panel/column scopes, and richer widgets such as custom rendering callbacks, dialogs, and a file dialog.
Clone and build the demo (enable exactly one backend feature):
$ cargo run --example demo-full --features example-vulkan # Vulkan backend
# or
$ cargo run --example demo-full --features example-glow # Glow backend

context.window(...) for every visible window or popup.Container that exposes high-level widgets (buttons, sliders, etc.) and lower-level drawing helpers.Container::with_row lets you scope a set of widgets to a row of SizePolicys, while nested columns can be created with container.column(|ui| { ... }).Widget trait (for example Button, Textbox, Slider). These structs hold interaction state and supply stable IDs.Renderer trait can be used. The included SDL2 + glow example demonstrates how to batch the commands produced by a container and upload them to the GPU.let mut name = Textbox::new("");
ctx.window(&mut main_window, ContainerOption::NONE, WidgetBehaviourOption::NONE, |ui| {
let widths = [SizePolicy::Fixed(120), SizePolicy::Remainder(0)];
ui.with_row(&widths, SizePolicy::Auto, |ui| {
ui.label("Name");
ui.textbox_ex(&mut name);
});
});
Window, dialog, and popup builders now accept a WidgetBehaviourOption to control scroll behavior. Use WidgetBehaviourOption::NO_SCROLL
for popups that should not scroll, WidgetBehaviourOption::GRAB_SCROLL for widgets that want to consume scroll, and
WidgetBehaviourOption::NONE for default behavior. Custom widgets receive consumed scroll in CustomRenderArgs::scroll_delta.
Some widgets can render an Image, which can reference either a slot or an uploaded texture at runtime:
let texture = ctx.load_image_from(ImageSource::Png { bytes: include_bytes!("assets/IMAGE.png") })?;
let mut image_button = Button::with_image(
"External Image",
Some(Image::Texture(texture)),
WidgetOption::NONE,
WidgetFillOption::ALL,
);
ui.button(&mut image_button);
Image::Slot renders an entry from the atlas and benefits from batching.Image::Texture targets renderer-owned textures (the backend handles binding when drawing).WidgetFillOption controls which interaction states draw a filled background; use WidgetFillOption::ALL to keep the default normal/hover/click fills.Context::load_image_rgba/load_image_from and Context::free_image to manage the lifetime of external textures.builder (default) – enables the runtime atlas builder and PNG decoding helpers used by the examples.png_source – allows serialized atlases and ImageSource::Png { .. } uploads to stay compressed.save-to-rust – enables AtlasHandle::to_rust_files to emit the current atlas as Rust code for embedding.Disabling default features leaves only the raw RGBA upload path (ImageSource::Raw { .. }):
cargo build --no-default-features
The demos require builder, so run them with --no-default-features plus builder:
cargo run --example demo-full --no-default-features --features "example-vulkan builder"
To export an atlas as Rust, enable save-to-rust (optionally png_source for PNG bytes) and call AtlasHandle::to_rust_files, or use the helper binary:
cargo run --bin atlas_export --features "builder save-to-rust" -- --output path/to/atlas.rs
Container::text_with_wrap supports explicit wrapping modes (TextWrap::None or TextWrap::Word) and renders wrapped lines back-to-back inside an internal column, so the block keeps the outer padding without adding extra spacing between lines.Container::draw_text directly when precise placement is required, or use draw_control_text to get automatic alignment/clip handling.button_ex* shims removed.update_control.Rc<Style> across containers/panels; window chrome state moved into Window.Container::style now uses Rc<Style>.std (Vec, parse, ...)begin_*, end_* functions to closuresPool