Expand description
Slide — wraps a child and slides it in or out from a chosen
edge when an external Signal<bool> toggles. Common patterns:
drawers, snackbars, side panels, banner notifications.
ⓘ
let visible = ctx.signal(false);
ctx.add(
Slide::new(visible.clone())
.from(SlideEdge::Bottom)
.child(snackbar_content),
);
// ...elsewhere:
visible.set(true); // slides in from below§Layout semantics
Slide’s own slot stays in its laid-out position; the child is
translated within the slot via place_children. The wrapper
clips so a sliding-in child doesn’t bleed past the slot edges.
The wrapper reports the child’s full natural size at all
progress values — siblings don’t reflow as the child slides.
For a “slide + fade” effect (notification snackbar), wrap the
child in Fade before passing it to Slide:
let _w = Slide::new(visible.clone())
.from(SlideEdge::Bottom)
.child(Fade::new(visible).child(snackbar_content));§Reduced motion
Honours prefers-reduced-motion: snaps the child instantly into
or out of position instead of tweening.
Structs§
- Slide
- Wraps a child widget and translates it in or out from one edge of
its slot whenever
visibleflips.
Enums§
- Slide
Edge - Which edge the child slides in from / out to.