From 9650ef85d68a4a6566bea4011f14a57614f8ec9a Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 19 May 2026 17:09:33 +0200 Subject: [PATCH] Smoother CollapsingHeader animation (#8177) Animate the spacing between the header and the body. It's subtle, but looks slightly nicer when closing a panel. --- crates/egui/src/containers/collapsing_header.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/egui/src/containers/collapsing_header.rs b/crates/egui/src/containers/collapsing_header.rs index d921a5cbf..cad9d5b3e 100644 --- a/crates/egui/src/containers/collapsing_header.rs +++ b/crates/egui/src/containers/collapsing_header.rs @@ -189,6 +189,8 @@ impl CollapsingState { self.store(ui.ctx()); // we store any earlier toggling as promised in the docstring None } else if openness < 1.0 { + ui.add_space((openness - 1.0) * ui.spacing().item_spacing.y); // animate spacing too + Some(ui.scope_builder(builder, |child_ui| { let max_height = if self.state.open && self.state.open_height.is_none() { // First frame of expansion.