list
Builds List


The code that drew it
A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.
fn list(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
stack(&theme)
.w(px(420.0))
.child(
div()
.type_scale(&theme, gpui_kit_theme::TypeScale::Caption)
.text_color(theme.colors.text_muted)
.child(SharedString::from(format!(
"{FIXTURE_RECORDS} fixture records; only the rendered ones publish"
))),
)
.child(
div()
.hairline(&theme)
.radius(&theme, Radius::Card)
.overflow_hidden()
.child(
List::new("scene.list.records", FIXTURE_RECORDS, |index, _, _| {
let (id, label) = fixture_record(index);
ListItem::new(id, label.clone()).text(label)
})
.selected(fixture_record(2).0)
.visible_rows(8)
.on_select(|_, _, _| {}),
),
)
.into_any_element()
}