Get started
Quickstart
Install the native libraries, add CrownUI to a project and open your first window.
CrownUI needs Rust 1.97 or newer and runs on Linux under a Wayland compositor. This page takes you from an empty directory to a running counter app.
Install and run
Install the native libraries
CrownUI links against Wayland, Vulkan, EGL, fontconfig, FreeType and D-Bus.
Arch Linux sudo pacman -S base-devel wayland wayland-protocols libxkbcommon \ vulkan-icd-loader vulkan-headers mesa fontconfig freetype2 dbusDebian 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-devCreate a project and add the crate
cargo new counter cd counter cargo add crownuiWrite the app
src/main.rs 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)) .hover(|style| style.scale(1.04)) .transition(Spring::snappy()), )) .p(24.0) .gap(12.0) }), AppConfig::new("Counter"), ) }Run it
cargo run
The first build downloads the Impeller SDK (about 23 MB) into .impeller_cache/. Later builds reuse
it.
What the code does
use crownui::prelude::*brings in every builder, modifier, signal type and color an app needs.crownui::run(view, config)opens a window and runs until it closes. Call it frommainbefore you start other threads.component(|cx| ..)runs its closure once. It creates state and returns the view tree.cx.signal(0)creates aSignal<i32>, a smallCopyhandle to a value in the runtime.text(bind(move |rt| ..))is a text whose content is recomputed whenever a signal it reads changes. Here only this one text updates when you click.button("+1").on_click(..)handles clicks. Handlers get(&mut Cx, &mut Event<T>)..hover(|style| style.scale(1.04))is a variant that applies while the pointer is over the button..transition(Spring::snappy())animates the change with a spring..p(24.0)and.gap(12.0)are Tailwind names with values in logical pixels.AppConfig::new("Counter")sets the window title. Its size defaults to 800 by 600.
Cargo features
| 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 | The in-app MCP server, so AI agents can drive the app. |
accessibility | yes | Screen reader support through AT-SPI. |
static | no | Links libimpeller statically. |
audio | no | Microphone capture over PipeWire, as crownui::audio and kit::use_microphone. |
crownui::run and crownui::run_windows exist only with both wayland and impeller on.
Offline and static builds
- Set
IMPELLER_CACHE_DIRto a vendored copy of the Impeller SDK to build without network access. - Enable the
staticfeature to link Impeller into your binary instead of loading the shared library at runtime.
cargo add crownui --features staticSee the logs
CrownUI logs through tracing. Errors carry a stable code such as CUI0402, listed on the
errors page. Add a subscriber to see them:
cargo add tracing-subscriberuse crownui::prelude::*;
fn main() -> Result<(), crownui::RunError> {
tracing_subscriber::fmt::init();
crownui::run(app(), AppConfig::new("Counter"))
}When it does not start
| Symptom | Fix |
|---|---|
RunError::Platform right away | No Wayland compositor is reachable. Run the app inside a Wayland session. |
CUI0402, the renderer was not created | Check the GPU driver, then try CROWNUI_RENDERER=gles cargo run to skip Vulkan. |
CUI0408, MCP did not start | Check the permissions of $XDG_RUNTIME_DIR/crownui. |
Run the examples
The repository has five examples. Clone it next to the four sibling repositories it depends on by path:
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
git clone https://github.com/Crown-OS/crownos-ipc.git
git clone https://github.com/Crown-OS/crownos-voice.git
cd crownui
cargo run -p crownui --example counter| 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. |
rust-toolchain.toml pins the toolchain, so rustup installs Rust 1.97 on the first build.