egui is an easy-to-use immediate mode GUI for Rust that runs on both web and native.
Try it now: https://www.egui.rs/
egui development is sponsored by Rerun, a startup building an SDK for visualizing streams of multimodal data.
egui changelog
✨ Highlights
This release adds initial support for multi-pass layout, which is a tool to circumvent a common limitation of immediate mode.
You can use the new UiBuilder::sizing_pass
(#4969) to instruct the Ui
and widgets to shrink to their minimum size, then store that size.
Then call the new Context::request_discard
(#5059) to discard the visual output and do another pass immediately after the current finishes.
Together, this allows more advanced layouts that is normally not possible in immediate mode.
So far this is only used by egui::Grid
to hide the "first-frame jitters" that would sometimes happen before, but 3rd party libraries can also use it to do much more advanced things.
There is also a new UiBuilder
for more flexible construction of Ui
s (#4969).
By specifying a sense
for the Ui
you can make it respond to clicks and drags, reading the result with the new Ui::response
(#5054).
Among other things, you can use this to create buttons that contain arbitrary widgets.
0.29 also adds improve support for automatic switching between light and dark mode.
You can now set up a custom Style
for both dark and light mode, and have egui follow the system preference (#4744 #4860).
There also has been several small improvements to the look of egui:
- Fix vertical centering of text (e.g. in buttons) (#5117)
- Sharper rendering of lines and outlines (#4943)
- Nicer looking text selection, especially in light mode (#5017)
The new text selection
What text selection used to look like
🧳 Migration
id_source
is now calledid_salt
everywhere (#5025)Ui::new
now takes aUiBuilder
(#4969)- Deprecated (replaced with
UiBuilder
):ui.add_visible_ui
ui.allocate_ui_at_rect
ui.child_ui
ui.child_ui_with_id_source
ui.push_stack_info
⭐ Added
- Create a
UiBuilder
for buildingUi
s #4969 by @emilk - Add
egui::Sides
for adding UI on left and right sides #5036 by @emilk - Make light & dark visuals customizable when following the system theme #4744 #4860 by @bash
- Interactive
Ui
:s: addUiBuilder::sense
andUi::response
#5054 by @lucasmerlin - Add a menu button with text and image #4748 by @NicolasBircksZR
- Add
Ui::columns_const()
#4764 by @v0x0g - Add
Slider::max_decimals_opt
#4953 by @bircni - Add
Label::halign
#4975 by @rustbasic - Add
ui.shrink_clip_rect
#5068 by @emilk - Add
ScrollArea::scroll_bar_rect
#5070 by @emilk - Add
Options::input_options
for click-delay etc #4942 by @girtsf - Add
WidgetType::RadioGroup
#5081 by @bash - Add return value to
with_accessibility_parent
#5083 by @bash - Add
Ui::with_visual_transform
#5055 by @lucasmerlin - Make
Slider
andDragValue
compatible withNonZeroUsize
etc #5105 by @emilk - Add
Context::request_discard
for multi-pass layouts #5059 by @emilk - Add UI to modify
FontTweak
live #5125 by @emilk - Add
Response::intrinsic_size
to enable better layout in 3rd party crates #5082 by @lucasmerlin - Add support for mipmap textures #5146 by @nolanderc
- Add
DebugOptions::show_unaligned
#5165 by @emilk - Add
Slider::clamping
for precise clamp control #5119 by @emilk
🚀 Performance
- Optimize
Color32::from_rgba_unmultiplied
with LUT #5088 by @YgorSouza
🔧 Changed
- Rename
id_source
toid_salt
#5025 by @bircni - Avoid some
Id
clashes by seeding auto-ids with child id #4840 by @ironpeak - Nicer looking text selection, especially in light mode #5017 by @emilk
- Fix blurry lines by aligning to pixel grid #4943 by @juancampa
- Center-align all text vertically #5117 by @emilk
- Clamp margin values in
Margin::ui
#4873 by @rustbasic - Make
scroll_to_*
animations configurable #4305 by @lucasmerlin - Update
Button
to correctly align contained image #4891 by @PrimmR - Deprecate
ahash
re-exports #4979 by @oscargus - Fix: Ensures correct IME behavior when the text input area gains or loses focus #4896 by @rustbasic
- Enable rustdoc
generate-link-to-definition
feature on docs.rs #5030 by @GuillaumeGomez - Make some
Memory
methods public #5046 by @bircni - Deprecate
ui.set_sizing_pass
#5074 by @emilk - Export module
egui::frame
#5087 by @simgt - Use
log
crate instead ofeprintln
& remove some unwraps #5010 by @bircni - Fix:
Event::Copy
andEvent::Cut
behave as if they select the entire text when there is no selection #5115 by @rustbasic
🐛 Fixed
- Prevent text shrinking in tooltips; round wrap-width to integer #5161 by @emilk
- Fix bug causing tooltips with dynamic content to shrink #5168 by @emilk
- Remove some debug asserts #4826 by @emilk
- Handle the IME event first in
TextEdit
to fix some bugs #4794 by @rustbasic - Slider: round to decimals after applying
step_by
#4822 by @AurevoirXavier - Fix: hint text follows the alignment set on the
TextEdit
#4889 by @PrimmR - Request focus on a
TextEdit
when clicked #4991 by @Zoxc - Fix
Id
clash inFrame
styling widget #4967 by @YgorSouza - Prevent
ScrollArea
contents from exceeding the container size #5006 by @DouglasDwyer - Fix bug in size calculation of truncated text #5076 by @emilk
- Fix: Make sure
RawInput::take
clears all events, like it says it does #5104 by @emilk - Fix
DragValue
range clamping #5118 by @emilk - Fix: panic when dragging window between monitors of different pixels_per_point #4868 by @rustbasic
eframe changelog
✨ Highlights
🧳 Migration
WebRunner::start
now expects aHtmlCanvasElement
rather than the id of it (#4780)NativeOptions::follow_system_theme
anddefault_theme
is gone, and is now inegui::Options
instead (#4860)
⭐ Added
- Conditionally propagate web events using a filter in WebOptions #5056 by @liamrosenfeld
🔧 Changed
- Pass
HtmlCanvasElement
element directly inWebRunner::start
#4780 by @jprochazk - Upgrade winit to 0.30.2 #4849 #4939 by @ArthurBrussee
- Allow non-
static
eframe::App
lifetime #5060 by @timstr - Improve
glow
context switching #4814 by @rustbasic - Ignore viewport size/position on iOS #4922 by @frederik-uni
- Update
web-sys
&wasm-bindgen
#4980 by @bircni - Remove the need for setting
web_sys_unstable_apis
#5000 by @emilk - Remove the
directories
dependency #4904 by @YgorSouza - It's now possible to opt-out of the wgpu-feature
fragile-send-sync-non-atomic-wasm
by @9SMTM6 in #5098 - Update to wgpu 22.1 #4964 by @wumpf & #4847 by @KeKsBoTer
- Wgpu paint callback now gets a
wgpu::RenderPass<'static>
, making it easier to insert resources not owned byCallbackResources
#5149 by @wumpf
🐛 Fixed
- Fix: call
save
when hiding web tab, andupdate
when focusing it #5114 by @emilk - Force canvas/text input focus on touch for iOS web browsers #4848 by @BKSalman
- Fix virtual keyboard on (mobile) web #4855 by @micmonay
- Fix: Backspace not working after IME input #4912 by @rustbasic
- Fix iOS build, and add iOS step to CI #4898 by @lucasmerlin
- Fix iOS compilation of eframe #4851 by @ardocrat
- Fix crash when changing viewport settings #4862 by @pm100
- Fix eframe centering on multiple monitor systems #4919 by @VinTarZ
- Fix viewport not working when minimized #5042 by @rustbasic
- Clarified
eframe::run_simple_native()
persistence #4846 by @tpstevens