-
Notifications
You must be signed in to change notification settings - Fork 9
Design Keyed State
MeowLynxSea edited this page Jan 23, 2026
·
8 revisions
gpui stores many pieces of UI state (cursor, selection, open menus, toggles, etc.) against an
ElementId.
Yororen UI uses the convention:
- Any Component that owns internal state should expose
key(...). -
key(...)is an alias ofid(...).
When to use:
- Any repeated UI (lists/grids).
- Virtualized rows.
- Anything reorderable.
Guideline:
- Keys should come from your data model (id/uuid/path).
- Do not use call-site location as identity when virtualization can recycle rows.
use gpui::ElementId;
use yororen_ui::component::{text_input, virtual_row};
let row = virtual_row(("settings", "username-row"))
.child(
text_input()
.key(ElementId::from((ElementId::from("settings"), "username")))
.placeholder("Username"),
);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.