GPUI patterns and primitives. Note: there is no button(),span(), or h1() element function — everything is built with div() and style modifiers. The ui crate provides higher-level components (tabs, modals, sliders).
The fundamental building block. All UI elements are divs with style modifiers. Text is added via .child().
Text is rendered by passing a string to .child(). There is no span() or p() element.
Interactive elements need .id() for click events to work. Hover uses the .hover() style modifier.
Low-level mouse events: on_mouse_down, on_mouse_up, on_mouse_move.
GPUI uses flexbox via style shortcuts. flex_1() sets flex-grow:1. overflow_y_scroll() enables scrolling.
Elements can be positioned with .absolute(), .relative(), .top(), .left(), etc.
Use .when() and .when_some() for conditional children.
On WASM, call cx.notify() at the start of render() to keep the frame loop running.