Expand description
ListItem โ a clickable, themed row used to build list-style UIs.
State (the selected index) lives on the caller, just like
Checkbox holds &mut bool. The matching
pattern is:
โ
egui::ScrollArea::vertical().show(ui, |ui| {
for (i, item) in items.iter().enumerate() {
let r = ui.add(
sc::ListItem::new(item)
.selected(selected == Some(i)),
);
if r.clicked() {
selected = Some(i);
}
}
});For visual grouping a List container wraps the rows in a bordered,
rounded frame.