Yororen UI uses a headless-first approach. Components are defined by their logic and accessibility (headless) and are visually rendered by a registered renderer.
When building your UI in a Render implementation, you use headless factory functions (e.g., button, label). These factories provide two primary ways to use them:
.apply(div): Injects only accessibility (a11y) attributes into an existing element..render(cx): Renders the full visual component using the currently registered renderer.
Special Case: Text Inputs
Text inputs require a two-parameter call to register the IME (Input Method Editor) processor on the window:
use yororen_ui::headless::button::button;
use yororen_ui::headless::label::label;
fn render(&mut self, _w: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
div().size_full().flex().items_center().justify_center().gap_2()
.child(label("count", "0", cx).render(cx))
.child(button("inc", cx).caption("+").render(cx))
}