pub struct Layers { /* private fields */ }Expand description
A container that renders children in overlapping layers
Children are rendered in order, with later children appearing on top of earlier ones. This is useful for:
- Modal dialogs
- Tooltips
- Gantt chart overlays
- Any UI where elements need to overlap
Z-index can be set per child to control stacking order. Children with higher z-index render on top. Children with equal z-index maintain insertion order.
§Example
ⓘ
use revue::prelude::*;
let layered = Layers::new()
.child(background_grid()) // z=0, bottom
.child_z(gantt_bars(), 1) // z=1, middle
.child_z(tooltip(), 10); // z=10, topImplementations§
Source§impl Layers
impl Layers
Sourcepub fn child<V: View + 'static>(self, child: V) -> Self
pub fn child<V: View + 'static>(self, child: V) -> Self
Add a child to the layer stack with default z-index (0)
Children added later will render on top of earlier children when z-index values are equal.
Sourcepub fn child_z<V: View + 'static>(self, child: V, z_index: i16) -> Self
pub fn child_z<V: View + 'static>(self, child: V, z_index: i16) -> Self
Add a child with an explicit z-index
Higher z-index values render on top. Children with equal z-index maintain insertion order (stable sort).
Sourcepub fn children<I, V>(self, children: I) -> Selfwhere
I: IntoIterator<Item = V>,
V: View + 'static,
pub fn children<I, V>(self, children: I) -> Selfwhere
I: IntoIterator<Item = V>,
V: View + 'static,
Add multiple children at once (all with default z-index 0)
Sourcepub fn min_height(self, height: u16) -> Self
pub fn min_height(self, height: u16) -> Self
Set minimum height constraint
Sourcepub fn max_height(self, height: u16) -> Self
pub fn max_height(self, height: u16) -> Self
Set maximum height constraint (0 = no limit)
Trait Implementations§
Source§impl StyledView for Layers
impl StyledView for Layers
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Remove a CSS class
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Toggle a CSS class
Auto Trait Implementations§
impl Freeze for Layers
impl !RefUnwindSafe for Layers
impl !Send for Layers
impl !Sync for Layers
impl Unpin for Layers
impl UnsafeUnpin for Layers
impl !UnwindSafe for Layers
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more