CrownUI is a declarative UI toolkit for Rust and the native toolkit of CrownOS. You build views once in a SwiftUI style, drive them with fine-grained signals, style them with Tailwind names and handle DOM-named events. Impeller renders every frame on a dedicated thread, and one semantic tree serves screen readers, tests and AI agents.
use crownui::prelude::*;
fn main() -> Result<(), crownui::RunError> {
crownui::run(
component(|cx| {
let count = cx.signal(0);
vstack((
text(bind(move |rt| format!("Count: {}", count.get(rt)))).text_size(24.0),
button("+1").on_click(move |cx, _| count.update(cx, |count| *count += 1)),
))
.p(24.0)
.gap(12.0)
}),
AppConfig::new("Counter"),
)
}CrownUI needs Rust 1.97 or newer and runs on Linux under a Wayland compositor.
cargo add crownuiThe first build downloads the Impeller SDK (about 23 MB) into .impeller_cache/. Set IMPELLER_CACHE_DIR to a vendored copy for offline builds, and enable the static feature to link Impeller into your binary.
Install the native libraries first.
Debian and Ubuntu:
sudo apt install build-essential pkg-config libwayland-dev wayland-protocols \
libxkbcommon-dev libvulkan-dev libegl1-mesa-dev libgbm-dev \
libfontconfig-dev libfreetype-dev libdbus-1-devArch Linux:
sudo pacman -S base-devel wayland wayland-protocols libxkbcommon \
vulkan-icd-loader vulkan-headers mesa fontconfig freetype2 dbus| Feature | Default | What it adds |
|---|---|---|
wayland |
yes | The Wayland platform. |
impeller |
yes | The Impeller renderer on Vulkan with a GLES fallback. |
tokio |
yes | Async tasks through cx.spawn. |
mcp |
yes | An in-app MCP server so AI agents can drive the app. |
accessibility |
yes | Screen reader support through AT-SPI. |
static |
no | Links libimpeller statically. |
The workspace depends on two sibling CrownOS repositories by path, so clone all three side by side.
mkdir crownos && cd crownos
git clone https://github.com/Crown-OS/crownui.git
git clone https://github.com/Crown-OS/crownos-config.git
git clone https://github.com/Crown-OS/crownos-protocols.git
cd crownui
cargo xtask checkrust-toolchain.toml pins the toolchain, so rustup installs the right version on the first build. cargo xtask check runs clippy, tests and rustfmt on the crates you changed. See AGENTS.md for every workspace command.
| Example | What it shows |
|---|---|
counter |
Signals, buttons and hover and press variants. |
todo |
Keyed lists, per-row signals, text input and delete actions. |
gallery |
Buttons, toggles and a text field in styled sections with dark mode variants. |
glass_card |
A canvas gradient behind a backdrop blur card that expands with a spring. |
kit_gallery |
The themed CrownOS widgets following the desktop theme. |
Run one with:
cargo run -p crownui --example counterRender any kit widget to a PNG without opening a window:
cargo xtask preview --list
cargo xtask preview button_primary --png button.png- Usage covers views, state, styling, events, the kit, windows, testing and agents.
- Architecture explains the crate layers, the two-thread frame pipeline and the semantic tree.
- Why CrownUI lists what makes CrownUI different.
- Components lists the primitive building blocks and how to write your own.
- Widgets lists the themed CrownOS widgets and how theming works.
- Naming maps Tailwind classes and DOM events to CrownUI methods.
- Errors indexes every diagnostic code with its fix.
- Impeller records how the renderer runs on CrownOS.
Each crate also has its own README.md with its public API and invariants.
CrownUI is dual licensed under MIT or Apache 2.0, at your option.
