Skip to main content

Stack

Function Stack 

Source
pub fn Stack<State: 'static, M>(
    children: impl ViewSeq<State, M>,
) -> StackView<State>
Expand description

Overlay children in a z-order stack (first child at the bottom).

children is any ViewSeq: a Vec/array of views, a tuple of mixed view types (positional, up to 12 and nestable), an Option (None drops the slot), or views(iter) for an iterator. Every element is erased once, here.

use frust_widgets::{Stack, StackView, text};
// Same type: a `Vec`. Mixed types: a tuple, no `any(..)` needed.
let layers = Stack(vec![text("under"), text("over")]);
let mixed = Stack((text("under"), Stack((text("over"), text("badge")))));