A Rust UI framework
Build interfaces in Rust.
Run anywhere.
Compose your UI with typed views and reactive state.
Run in the browser or on native desktop.
01 / A view, in a few lines.
counter.rs
use refract::prelude::*;
#[view]
fn counter(cx: &mut ViewContext<'_>) -> impl View {
#[state]
let count: u32 = 0;
#[action(count)]
let increment = |cx| {
count.update(cx.runtime(), |n| *n += 1);
};
button(
text(format!("Count: {}", cx.read(&count))),
increment,
)
.padding(16.0)
}Interactive sketch001
A little state goes a long way.
00
React illustration of the Rust example.
Run the real thing with the quick start below.
Typed composition
Views all the way down.
Build with stacks, text, and controls. Compose them with Rust’s type system and a small set of familiar modifiers.
Tracked dependencies
State with a clear path.
An attribute graph tracks what each view reads. Changes invalidate their consumers and produce semantic patches.
Platform-aware hosting
Shared core. Local character.
DOM and CSS in the browser. Winit, Taffy, Parley, and Vello on desktop. Platform services stay at the edges.
From source to screen
Give it a window.
Start with the counter in your local Refract checkout. Pick a platform, run the example, and make it your own.
Read the setup guideTerminal · repository root
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.130 --locked --root .tools
./scripts/build-web.sh
python3 scripts/serve.pyRust 1.93+ · Browser setup requires Python 3 · Desktop tested on macOS