Components / Sticky
Sticky
Stays below the top while its section scrolls past.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn sticky() -> impl View {
let section = |name: &'static str| {
let rows: Vec<AnyView> =
(1..=6).map(|n| Box::new(Text::new(format!("{name} {n}"))) as AnyView).collect();
VStack::new((Sticky::new(Badge::new(name).tone(Tone::Accent)), VStack::new(rows).spacing(8.0)))
.spacing(8.0)
};
ScrollView::new((section("Inputs"), section("Overlays"), section("Data"))).spacing(16.0).height(220.0)
}