-
Notifications
You must be signed in to change notification settings - Fork 9
Design Virtualization
MeowLynxSea edited this page Jan 23, 2026
·
3 revisions
Virtualization keeps scrolling smooth by only building and laying out what is visible.
-
VirtualList(widget): a wrapper aroundgpui::list(ListState, ...). -
VirtualRow(component): a virtualization-safe row shell.
- Stable per-row key (required).
- Row-local element namespace, so
Location::caller()-based ids don’t collide across recycled rows. - Row spacing/dividers belong to the shell; callers render only content.
If a row’s height changes (expand/collapse, async-loaded content), call controller methods such as:
VirtualListController.reset(...)VirtualListController.splice(...)
use gpui::{AnyElement, ListAlignment, px};
use yororen_ui::{
component::{list_item, virtual_row},
widget::{virtual_list, virtual_list_state},
};
let state = virtual_list_state(1000, ListAlignment::Top, px(256.));
let list = virtual_list(state, move |ix, _window, _cx| -> AnyElement {
virtual_row(("row", ix))
.gap_below(px(6.))
.child(list_item().content(format!("Row {ix}")))
.into_any_element()
});Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.