Skip to content

Get started

Introduction ​

Tessera builds interfaces from plain Rust functions and reactive state, and renders every pixel directly through wgpu. The same UI code runs on Windows, macOS, Linux, Android, iOS, and the browser—with no WebView and no native widget bindings.

Declarative UI in pure Rust ​

A component is a Rust function marked with #[tessera]. Calling a component declares that piece of UI in place and returns a typed handle for optional configuration. Child UI goes into closures, and persistent state lives in remember handles.

rust
use tessera_components::{
    column::column,
    md3::{button::button, surface::surface, text::text, theme::material_theme},
};
use tessera_foundation::modifier::ModifierExt as _;
use tessera_ui::{Dp, Modifier, remember, tessera};

#[tessera]
pub fn app() {
    let count = remember(|| 0i32);

    material_theme().child(move || {
        surface()
            .modifier(Modifier::new().fill_max_size())
            .child(move || {
                column()
                    .modifier(Modifier::new().padding_all(Dp(16.0)))
                    .children(move || {
                        text(format!("Count: {}", count.get()));
                        button()
                            .filled()
                            .on_click(move || count.with_mut(|n| *n += 1))
                            .child(|| text("Increment"));
                    });
            });
    });
}

remember(|| 0i32) initializes the count once and keeps its State<i32> handle across updates. Clicking the button updates count, and the text that reads count.get() rebuilds with the new label. Around it, material_theme() supplies colors, typography, and shapes, surface() paints the window background, and column() stacks the label above the button.

Projects scaffolded with cargo tessera wire this root component into EntryPoint in src/lib.rs and install ComponentsPackage so every target platform boots from one shared entry. See Project structure.

Crate layout ​

New projects depend on the first three crates by default:

  • tessera-ui: the core runtime—#[tessera], State and Model, Modifier, EntryPoint, layout/draw extension traits, and UiTest.
  • tessera-foundation: design-system-agnostic primitives—alignment, Shape, gesture recognizers, and layout/semantics modifiers.
  • tessera-components: design-system-agnostic layout and media primitives (row, column, boxed, image, pager) at the crate root, Material 3 Expressive controls and theming under tessera_components::md3, and experimental glass under tessera_components::experiment.
  • tessera-platform: desktop window controls and clipboard services (installed by ComponentsPackage).
  • tessera-shard: screen navigation (#[shard], shard_home, RouterController) with route-scoped models. Add with cargo add tessera-shard.

Localization lives in tessera-i18n, build-time asset and catalog generation lives in tessera-build, and cargo tessera handles scaffolding, checking, live development, and packaging.

For full parameter lists and controller methods, see the component API reference and runtime API reference, or explore the live WebGPU gallery.

Reading path ​