Reusable UI components and widgets built on top of gpui.
Reusable UI components and widgets built on top of gpui.
中文版 · English
Yororen UI is a headless-first Rust UI library built on top of gpui (via gpui-ce). A button is not a visual — it is a focusable, clickable thing with a label and an optional icon. The visual is a plug-in.
theme JSON ─▶ renderer (XxxRenderer) ─▶ headless (XxxProps) ─▶ gpui-ceyororen-ui-core) — data, state, a11y, i18n, RTL, animation, assets. No visual decisions.yororen-ui-default-renderer · yororen-ui-brutalism-renderer) — turns props into a styled div. 55 trait slots, filled with Token* or Brutal* impls. Swap the renderer, change the entire look.action.primary.bg; missing paths fall back to renderer defaults.The meta-crate yororen-ui re-exports core + the default renderer + three bundled locales, so most apps need a single dependency. Add the brutalism or xml feature to opt into the alternative renderer or the XML DSL.
Capability
What you get
55 components
Buttons, inputs, badges, tooltips, modals, popovers, selects, lists, virtualised lists, trees, tables, and more
Three-layer architecture
Headless primitives + JSON themes + swappable visual renderers (default + brutalism)
JSON themes
Swap palettes at runtime with one install() call
Animation system
AnimatedVisibility on every stateful composite, plus presets and easing functions
Internationalization
en, zh-CN, ar bundled; ar flips layout to RTL via cx.i18n().text_direction()
Accessibility
Focus management, keyboard navigation, click-outside guards, scroll-lock counter, focus trap
Embedded assets
20+ SVG icons bundled via rust-embed
Notification system
NotificationCenter global with auto-dismiss timers, sticky flag, and persistence
Optional XML DSL
Declarative screens via xml! / xml_file! macros…Inside your Render::render:
use yororen_ui::headless::button::button;
use yororen_ui::headless::label::label;
fn render(&mut self, _w: &mut Window, cx: &mut Context) -> 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))
}Every headless factory exposes both .apply(div) (a11y only) and .render(cx) (full visual via the registered renderer). For text inputs, .render(cx, window) is two-arg and registers an IME handler.
Swap renderers or themes (optional)
use yororen_ui::brutalism_renderer;
brutalism_renderer::install(cx); // sharp corners, hard shadows, monospaceuse yororen_ui_default_renderer::{Theme, install_with};
const MY_THEME: &str = include_str!("../themes/my-brand.json");
install_with(cx, Theme::from_json(MY_THEME).expect("valid JSON"));Call yororen_ui::theme::install(cx, new_theme) inside a Render impl — every frame, or when the user picks a new palette. Idempotent and cheap.
impl Render for MyApp {
fn render(&mut self, _w: &mut Window, cx: &mut Context) -> impl IntoElement {
yororen_ui::theme::install(cx, self.current_theme());
// … rest of render …
}
}counter — minimal bootstrap, single Entity global, three buttons.
cargo run -p counter-demogallery_demo — kitchen-sink reference: every component, theme switching, i18n, notifications, virtualised list.
cargo run -p gallery-demoinputs_demo — all seven text inputs wired with cx.entity().clone(). Handles Tab / Enter / Esc / ⌘V.
cargo run -p inputs-demolayers_demo — the three render pathways side by side + a hand-rolled Material ripple.
cargo run -p layers-demotheme_showcase — live theme switching via theme::install per render. Cycles four themes.
cargo run -p theme-showcase-demovariant_showcase — ActionVariantKind comparison (Neutral / Primary / Danger) with the same headless::button factory.
cargo run -p variant-showcase-demogallery_xml — the gallery written with the XML DSL instead of the Rust builder API.
cargo run -p gallery-xml-demoshowcase_xml — smaller XML-DSL smoke test.
cargo run -p showcase-xml-demoCrate
Role
yororen-ui-core
Headless primitives, theme JSON access, i18n, a11y, RTL, animation, assets, notification center
yororen-ui-default-renderer
55 TokenXxxRenderer impls + bundled system-light.json / system-dark.json themes + renderer::install bootstrap
yororen-ui-brutalism-renderer
(optional, feature brutalism) Sharp corners, thick black borders, hard offset shadows, monospace typography
yororen-ui-xml + yororen-ui-xml-macro
(optional, feature xml, default-on) XML DSL: xml!, xml_file!, register_xml_component!, bind
yororen-ui-locale-{en, zh-CN, ar}
Bundled JSON translation catalogs
yororen-ui
(meta-crate) Re-exports the above. Most apps need only this.
theme JSON ─▶ renderer (XxxRenderer) ─▶ headless (XxxProps) ─▶ gpui-ceserde_json::Value you can swap at runtime.The 55 component markers (yororen-ui-core::renderer::markers) are the keys into the global RendererRegistry. The default and brutalism renderers each implement all 55 trait slots.
A custom renderer only needs to implement the 55 XxxRenderer traits — it doesn't touch the headless layer.
From crates.io (recommended)
[dependencies]
yororen_ui = "0.3"The xml feature is enabled by default so xml! / xml_file! work out of the box. To opt out:
[dependencies]
yororen_ui = { version = "0.3", default-features = false }To enable specific features:
[dependencies]
yororen_ui = { version = "0.3", default-features = false, features = ["xml", "brutalism"] }From GitHub (latest development build)
[dependencies]
yororen_ui = { git = "https://github.com/MeowLynxSea/yororen-ui.git", tag = "v0.3.0" }From a local path (development)
[dependencies]
yororen_ui = { path = "../yororen-ui" }gpui dependency
gpui is provided via the gpui-ce crate on crates.io. Make sure your application uses a compatible version:
[dependencies]
gpui = { package = "gpui-ce", version = "0.3" }In this repository, gpui-ce is specified in Cargo.toml.
Licensed under the Apache License, Version 2.0. Built on top of gpui (Zed Industries), also Apache-2.0. See LICENSE and NOTICE for attribution.
Issues and PRs are welcome. When changing visuals:
See the Yororen UI Wiki for guides, recipes, and per-component references.
No open issues yet, or sync has not completed.