Skip to content

Component VirtualRow

MeowLynxSea edited this page Jan 24, 2026 · 6 revisions

VirtualRow

A virtualization-safe row shell.

Example

use gpui::px;
use yororen_ui::component::{list_item, virtual_row};

let row = virtual_row(("item", 42))
    .gap_below(px(6.))
    .child(list_item().content("Row content"));

Contract

  • Stable key is required.
  • Spacing/dividers should be attached to the row shell.
  • If row height changes after render, notify the list via VirtualListController.

When to use

  • Any row rendered inside VirtualList
  • Any UI where rows can be recycled/reordered and you need stable identities

API

  • virtual_row(key) / VirtualRow::key(key): provide stable per-row key (required)
  • divider(bool): whether to render a divider below the row
  • gap_below(px(...)): spacing below the row

Notes

  • VirtualRow also installs a per-row element namespace so Location::caller() ids inside row content do not collide across recycled rows.

Defaults

  • divider(false)
  • gap_below(0px)

Example: Divider + spacing

use gpui::px;
use yororen_ui::component::{list_item, virtual_row};

let row = virtual_row(("row", 0))
    .divider(true)
    .gap_below(px(6.))
    .child(list_item().content("Row with divider"));

Clone this wiki locally