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
- Automatic sizing of menus/popups/tooltips with no jittering, using new sizing pass #4557, #4579 by @emilk
- Support interactive widgets in tooltips #4596 by @emilk
- Add a
ui.stack()
with info about all ancestorUi
s, with optional tags #4588 by @abey79, #4617 by @emilk - GIF support #4620 by @JustFrederik
- Blinking text cursor in
TextEdit
#4279 by @emilk
🧳 Migration
- Update MSRV to 1.76 (#4411)
- The
wrap/truncate
functions onLabel/Button/ComboBox
no longer take bools as arguments. Use.wrap_mode(…)
instead for more fine control (#4556) Style::wrap
has been deprecated in favor ofStyle::wrap_mode
(#4556)Ui::new
andui.child_ui
now takes a new parameter for theUiStack
(#4588)- The
extra_asserts
andextra_debug_asserts
feature flags have been removed (#4478) - Remove
Event::Scroll
and handle it in egui. UseEvent::MouseWheel
instead (#4524) Event::Zoom
is no longer emitted on ctrl+scroll. UseInputState::smooth_scroll_delta
instead (#4524)ui.set_enabled
andset_visbile
have been deprecated (#4614)DragValue::clamp_range
renamed torange
((#4728)
⭐ Added
- Overload operators for
Rect + Margin
,Rect - Margin
etc #4277 by @emilk - Add
Window::order
#4301 by @alexparlett - Add a way to specify Undoer settings and construct Undoers more easily #4357 by @valadaptive
- Add xtask crate #4293 by @YgorSouza
- Add
ViewportCommand::RequestCut
,RequestCopy
andRequestPaste
to trigger clipboard actions #4035 by @bu5hm4nn - Added ability to define colors at UV coordinates along a path #4353 by @murl-digital
- Add a
Display
impl forVec2
,Pos2
, andRect
#4428 by @tgross35 - Easing functions #4630 by @emilk
- Add
Options::line_scroll_speed
andscroll_zoom_speed
#4532 by @emilk - Add
TextEdit::hint_text_font
#4517 by @zaaarf - Add
Options::reduce_texture_memory
to free up RAM #4431 by @varphone - Add support for text truncation to
egui::Style
#4556 by @abey79 - Add
Response::show_tooltip_ui
andshow_tooltip_text
#4580 by @emilk - Add
opacity
andmultiply_opacity
functions toUi
andPainter
#4586 by @emilk - Add
Key::Quote
#4683 by @mkeeter - Improve backtraces when hovering widgets with modifiers pressed #4696 by @emilk
- Add
PopupCloseBehavior
#4636 by @Umatriz - Add basic test for egui accesskit output #4716 by @Wcubed
- Add
clamp_to_range
option to DragValue, renameclamp_range
torange
(deprecating the former) #4728 by @Wumpf - Add
Style::number_formatter
as the default used byDragValue
#4740 by @emilk
🔧 Changed
- Improve the UI for changing the egui theme #4257 by @emilk
- Change the resize cursor when you reach the resize limit #4275 by @emilk
- Make
TextEdit
an atomic widget #4276 by @emilk - Rename
fn scroll2
tofn scroll
#4282 by @emilk - Change
Frame::multiply_with_opacity
to multiply in gamma space #4283 by @emilk - Use parent
Ui
s style for popups #4325 by @alexparlett - Take
rounding
into account when usingSlider::trailing_fill
#4308 by @rustbasic - Allow users to create viewports larger than monitor on Windows & macOS #4337 by @lopo12123
- Improve
ViewportBuilder::with_icon()
documentation #4408 by @roccoblues include_image!
now accepts expressions #4521 by @YgorSouza- Remove scroll latency for smooth trackpads #4526 by @emilk
- Smooth out zooming with discreet scroll wheel #4530 by @emilk
- Make
TextEdit::return_key
optional #4543 by @doonv - Better spacing and sizes for (menu) buttons #4558 by @emilk
ComboBox
: fix justified layout of popup if wider than parent button #4570 by @emilk- Make
Area
state public #4576 by @emilk - Don't persist
Area
size #4749 by @emilk - Round text galley sizes to nearest UI point size #4578 by @emilk
- Once you have waited for a tooltip to show, show the next one right away #4585 by @emilk
- Fade in windows, tooltips, popups, etc #4587 by @emilk
- Make
egu::menu
types public #4544 by @sor-ca - The default constrain rect for
Area/Window
is nowctx.screen_rect
#4590 by @emilk - Constrain
Area
s to screen by default #4591 by @emilk Grid
: set thesizing_pass
flag during the initial sizing pass #4612 by @emilk- Remove special case for 0 in DragValue default formatter #4639 by @YgorSouza
- Abort drags when pressing escape key #4678 by @emilk
- Allow setting a layer as a sublayer of another #4690 by @YgorSouza
- Close context menus with Escape #4711 by @emilk
- Cancel DragValue edit if Escape is pressed #4713 by @YgorSouza
- The default parser for
DragValue
andSlider
now ignores whitespace #4739 by @emilk - Disabled widgets are now also disabled in the accesskit output #4750 by @Wcubed
- Make it easier to grab the handle of a floating scroll bar #4754 by @emilk
- When debugging widget rects on hover, show width and height #4762 by @emilk
- Make sure all tooltips close if you open a menu in the same layer #4766 by @emilk
🐛 Fixed
- Fix wrong replacement function in deprecation notice of
drag_released*
#4314 by @sornas - Consider layer transform when positioning text agent #4319 by @juancampa
- Fix incorrect line breaks #4377 by @juancampa
- Fix
hex_color!
macro by re-exportingcolor_hex
crate fromecolor
#4372 by @dataphract - Change
Ui::allocate_painter
to inherit properties fromUi
#4343 by @varphone - Fix
Panel
incorrect size #4351 by @zhatuokun - Improve IME support with new
Event::Ime
#4358 by @rustbasic - Disable interaction for
ScrollArea
andPlot
when UI is disabled #4457 by @varphone - Don't panic when replacement glyph is not found #4542 by @RyanBluth
- Fix
Ui::scroll_with_delta
only scrolling if theScrollArea
is focused #4303 by @lucasmerlin - Handle tooltips so large that they cover the widget #4623 by @emilk
- ScrollArea: Prevent drag interaction outside the area #4611 by @s-nie
- Fix buggy interaction with widgets outside of clip rect #4675 by @emilk
- Make sure contents of a panel don't overflow #4676 by @emilk
- Fix:
Response::hover_pos
returns incorrect positions with layer transforms #4679 by @Creative0708 - Fix: Menu popups and tooltips don't respect layer transforms #4708 by @Creative0708
- Bug fix: report latest area size in
Area::show
response #4710 by @emilk - Ensure
Window
scroll bars are at the window edges #4733 by @emilk - Prevent
TextEdit
widgets from sending fake primary clicks #4751 by @Aliremu - Fix text selection when there's multiple viewports #4760 by @emilk
- Use correct cursor icons when resizing panels too wide or narrow #4769 by @emilk
eframe changelog
✨ Highlights
The eframe web canvas now works properly when its a small part of a larger web page.
Previously this caused a lot of weird bugs, such as the eframe canvas stealing focus, and resizing the canvas in annoying ways.
Now it should all work seamlessly to have an eframe canvas as part of a web page, including having multiple different eframe apps next to each other.
As part of that the eframe canvas can now be focused (or not), just like an <input>
HTML element.
We've also implemented a better method for sizing and positioning the canvas so that it yields pixel-perfect rendering on all known browsers except for Desktop Safari.
What this means is that text is much less likely to be blurry on web for users (#4536 by @jprochazk).
⭐ Added
- Add
register_native_texture
ineframe::Frame
#4246 by @Chaojimengnan - Add
NativeOptions::persistence_path
#4423 by @lucasmerlin - Make sure to call
raw_input_hook
on web #4646 by @owen-d
🔧 Changed
- Early-out from context switching the
glow
backend #4284, #4296 by @emilk - Allow users to create viewports larger than monitor on Windows & macOS #4337 by @lopo12123
- Use
objc2
and its framework crates #4395 by @madsmtm - Emit physical key presses when a non-Latin layout is active #4461 by @TicClick
- Clamp window size to monitor size by default on all platforms #4410 by @rustbasic
- Ignore synthetic key presses #4514 by @hut
- Use
ResizeObserver
instead ofresize
event #4536 by @jprochazk - Make pinch-to-zoom more responsive on web #4621 by @emilk
- Move first
request_animation_frame
into resize observer #4628 by @jprochazk - Replace
directories-next
dependency withdirectories
#4661 by @crumblingstatue eframe::Result
is now short foreframe::Result<()>
#4706 by @emilk- Ignore keyboard events unless canvas has focus #4718 by @emilk
- wgpu updated to 0.20 #4560 by @emilk
🐛 Fixed
- Fix
ViewportCommand::InnerSize
not resizing viewport on Wayland (#4211) #4211 by @rustbasic - Improve IME support with new
Event::Ime
#4358 by @rustbasic - IME for chinese #4436 by @rustbasic
- Fix: Window position creeps between executions on scaled monitors #4443 by @avery-radmacher
- Fix: still track mouse when dragging outside web canvas #4522 by @emilk
- Fix: Don't
.forget()
RAF closure #4551 by @jprochazk - Improve web text agent #4561 by @jprochazk
- Fix broken mouse coordinates when there's padding on the canvas element #4729 by @emilk
- Only repaint on cursor movements of area, or if dragging outside #4730 by @emilk
- Fix drag-and-drop file preview/hover #4732 by @emilk
- Fix stuck keys after pressing ctrl+C, cmd+A, etc #4731 by @emilk
🧳 Migration
Wrap app creator in a Result
Applications can now return an error during the app creation (#4565 by @emilk), so you now need to wrap your Box<dyn App>
in a Result
like so:
- eframe::run_native("My App", options, Box::new(|cc| Box::new(MyApp::new(cc))));
+ eframe::run_native("My App", options, Box::new(|cc| Ok(Box::new(MyApp::new(cc)))));
Change web CSS
To make the eframe canvas fill the entire web browser, set its CSS to:
top: 0;
left: 0;
width: 100%;
height: 100%;
See index.html
and #4536 for details.
Web canvas focus
If you are using eframe for a fullscreen app, you should call .focus()
on your canvas during startup:
document.getElementById("the_canvas_id").focus();