Xilem: The Rust UI Framework That Splits Intent From Execution

A reactive view layer on top of a retained widget engine, Xilem is Linebender’s answer to the hardest part of native UI in Rust: how to be declarative without fighting ownership, layout, rendering, or accessibility.

9 min read View on GitHub More from linebender

A wide black-ink editorial scene showing a fragile, translucent tree on one side and a dense machine-like tree on the other. A thin stream of changes passes through the center and only a few parts of the machine move, explaining how Xilem separates transient view descriptions from persistent widget state.
Xilem’s core move is to let the view tree disappear while the widget tree keeps working.
Key Takeaways

The interesting part of linebender/xilem is not that it is another Rust UI framework. It is that it refuses to collapse intent and execution into one thing. You write a short-lived view description. Masonry keeps the durable widget state, handles events, measures space, paints pixels, and feeds accessibility.

The real idea: a UI tree that disappears

In Xilem, the View tree is not the UI. It is a temporary description of what the UI should be. That sounds subtle, but it is the whole design.

Rust makes long-lived mutable UI trees awkward. Ownership wants clear boundaries. UI frameworks want state that outlives a single render pass. Xilem’s answer is to let the high-level tree vanish after reconciliation, while the lower-level widget tree persists and does the actual work.

Why Masonry exists at all

Masonry is the engine room. It is a retained-mode widget toolkit with a strict lifecycle: pointer events, text events, measurement, layout, painting, and accessibility hooks all live there. Xilem sits on top of it, but Masonry is what makes the whole stack real.

That choice matters. A thin wrapper over generic primitives would leave Xilem dependent on someone else’s compromises. Instead, Linebender is building the substrate itself. The payoff is control over the pieces that usually decide whether a UI toolkit feels native or brittle.

// Conceptual shape, simplified
fn app_view(state: &AppState) -> impl View<AppState> {
    VStack::new()
        .with_child(Label::new(state.title.clone()))
        .with_child(
            Button::new("Increment")
                .on_click(|state| state.count += 1)
        )
}

// Xilem produces a new View tree from state,
// then reconciles only the necessary Masonry mutations.

That lifecycle is why Masonry matters more than it first appears. Measurement and layout are not afterthoughts. Accessibility is not bolted on later. They are part of the runtime contract.

How a state change becomes a UI update

The reconciliation flow is the key technical move. A state change produces a new View tree. Xilem compares it with the previous tree. Then it mutates Masonry only where the structure or properties actually changed.

That means the framework is neither fully immediate mode nor a naive rebuild-everything virtual DOM. The View tree is typed and lightweight. The widget tree is persistent and capable. The diff between them is what keeps the system small enough to reason about and powerful enough to run native UI.

StepWhat happensWhat stays stable
State changeApplication state mutatesThe app model
New View treeXilem re-runs view codeThe previous widget tree
DiffXilem identifies structural and property changesUnchanged widget nodes
Masonry mutationOnly selected widgets updateWidget IDs, layout context, accessibility linkage

That is the trick. The framework lets you write declarative UI without forcing Rust to pretend that the whole tree is a disposable blob. Only the description is disposable.

The ecosystem is part of the thesis

Xilem is not a crate in isolation. It is the visible top of a stack that includes Vello for rendering, Parley and Fontique for text, AccessKit for accessibility, and winit for windowing. Each piece exists because the project wants to own the full path from state change to painted, accessible pixels.

That is a big bet. It also explains why Xilem feels more like a platform thesis than a framework release. The architecture only makes sense if the pieces below it are good enough to justify the complexity above it.

A close editorial view of a workbench with a sheet of paper on top of a metal grid. New view instructions are written on the paper, but only a few stamped changes travel down into the grid of widget nodes, while a side lane carries accessibility metadata in parallel. The scene explains that reconciliation touches only specific runtime nodes.
Reconciliation is selective. The new view description does not rebuild everything, it updates only the parts that changed.

How Xilem compares to the field

Xilem is easiest to understand by contrast. It is not trying to be the simplest Rust UI toolkit, and it is not trying to be the most web-native. It is trying to occupy a narrower and stranger space: statically typed view descriptions, retained runtime execution, and deep integration with a custom renderer and accessibility stack.

ProjectModelTypical strengthWhere Xilem differs
XilemTyped view tree over retained widgetsNative feel with strong ownership disciplineVertical integration from views to renderer
IcedElm-inspired architectureStraightforward reactive desktop appsLess vertically integrated below the UI layer
DioxusReact-like virtual DOMCross-platform reach and web familiarityMore VDOM-oriented and WebView-friendly
SlintDSL-driven toolkitPolished tooling and stable product focusLess like embedded reactive Rust code
EguiImmediate modeFast to use for tools and prototypesDifferent trade-off on persistence and accessibility

The point of the comparison is not to pick a winner. It is to show the bet. Xilem leans toward persistent runtime state, typed reactive views, and a custom native stack. That is a very specific answer to the Rust UI problem.

What still makes Xilem experimental

The project is candid about its own rough edges. Styling is still a major challenge. Documentation is thinner than the architecture deserves. The web backend exists, but it does not yet carry the same confidence as the native path.

That honesty matters. Xilem reads less like a finished toolkit than a research program with unusually strong engineering discipline. The codebase is a serious attempt to define what native Rust UI should become, but it is still working through the hard parts that decide whether a framework becomes infrastructure or remains an experiment.