Skip to content
sammwyyPublic

About

A native, reactive UI framework for Rust desktop, web & mobile applications.

Topics

Resources

Contributing

Stars

46 stars

Watchers

3 watching

Forks

Repository files navigation

CreamUI

A native, reactive UI framework for Rust desktop applications.

CreamUI pairs a familiar component model with native windows, CSS-like flex and grid layout, JSX syntax, and a configurable application theme. It is built for apps that want a small Rust-native UI stack without embedding a web view.

Project status: early MVP. The public API is evolving; Linux is the currently supported desktop target.

Why CreamUI?

  • Native desktop windows through winit, with GPU or CPU presentation.
  • Reactive state with small, straightforward Signal values.
  • Headless raw widgets and polished themed widgets in the same toolkit.
  • JSX syntax that compiles to ordinary Rust widget builders.
  • Flex and grid layouts powered by Taffy.
  • Accessible keyboard interactions for the standard controls.
  • Built-in date, time, color, and native file pickers.
  • PNG by default, with opt-in JPEG and WebP image decoding.
  • An optional C ABI for shared runtimes and non-Rust hosts.

Components

CreamUI includes text, buttons, text inputs, text areas, checkboxes, switches, sliders, select/list/radio controls, tabs, sidebars, scroll views, trees, tables, popovers, dialogs, progress indicators, pickers, and images.

Core controls have lower-level Raw* counterparts for manual styling. Composite themed widgets can also be customized with Styled or assembled from raw controls and layout primitives. See the component catalog for the available foundations.

Specialized widgets are opt-in crates under extras/. For example, creamui-chart provides raw/themed charts, creamui-diff-viewer provides raw/themed patch review, and creamui-grid-layout provides a draggable dashboard grid. Only applications that depend on an extra compile it; the optional component catalog lists the available crates.

Quick start

Add the runtime crates to your application:

[dependencies]
creamui = { version = "0.1", features = ["jsx"] }

Then create a window and return a widget tree:

use creamui::widgets::layout::{Align, Flex, Justify};
use creamui::{run, BoxedWidget, Button, Signal, Size, Text, Theme, WindowOptions};

fn main() {
    let clicks = Signal::new(0_u32);

    run(
        WindowOptions {
            title: "Hello CreamUI".into(),
            width: 480,
            height: 320,
            ..Default::default()
        },
        Theme::default().surface,
        |_| {},
        move |viewport: Size| -> BoxedWidget {
            let theme = Theme::default();
            let increment = clicks.clone();
            Box::new(
                Flex::column()
                    .size(viewport.width, viewport.height)
                    .gap(12.0)
                    .justify(Justify::Center)
                    .align(Align::Center)
                    .background(theme.surface)
                    .child(Box::new(Text::new("Hello, CreamUI!").font_size(28.0)))
                    .child(Box::new(Text::new(format!("Clicked {} times", clicks.get()))))
                    .child(Box::new(Button::new("Click me", move || increment.update(|n| *n += 1)))),
            )
        },
    );
}

Explore the examples

cargo run -p hello-world
cargo run -p showcase
cargo run -p pickers
cargo run -p images
cargo run -p flex
cargo run -p jsx-styles
cargo run -p tray

These examples build CPU-only by default. To include GPU rendering in an application, enable its gpu feature; the window still starts on CPU unless it requests RenderBackend::Gpu or the backend is overridden at launch:

CUI_OVERRIDE_RENDER_BACKEND=gpu cargo run -p hello-world --features gpu

The showcase is the fastest way to explore the available controls and theme behavior. The tray example shows a persistent background application: closing its window leaves the process alive, while the system tray can create it again, update a reactive counter, or quit the process.

Web showcase demo

The same showcase can be compiled to WASM and opened in a browser:

demo/build.sh          # builds every demo under demo/ to demo/<name>/pkg/
demo/serve.sh          # serves demo/ statically at http://localhost:8080

Open http://localhost:8080/showcase/. Its canvas fills the whole page and takes mouse/keyboard input like a native window. See demo/showcase for asynchronous file selection and clipboard access, and demo/build.sh --dev for a faster, unoptimized build while iterating.

Android

Install the Rust target, Android SDK/NDK, and cargo-apk, then build the NativeActivity demo:

rustup target add aarch64-linux-android
cargo install cargo-apk
cargo apk build -p creamui-android-demo --target aarch64-linux-android

ANDROID_HOME and ANDROID_NDK_HOME must point at the installed SDK and NDK. The demo runs the interactive showcase with GPU or CPU presentation, touch and keyboard input, text clipboard access, safe-area insets, and a file path modal. The modal accepts readable local files with matching extensions; it does not request storage access through Android's document provider. Both presenters release their native surfaces during suspension and recreate them on resume, keeping reactive state and forcing a complete first frame. Android supports one activity window: additional window and native popup requests are rejected with a warning, and their ready callbacks do not run. Use hosted overlays for secondary views. Closing the activity window exits by default; keep_running() allows creating a replacement after it closes. See file picker integration for the modal host.

See platform builds and Android signing for debug and release APK commands, secure keystore handling, and Windows desktop builds.

Documentation

Workspace crates

Crate Use it for
creamui Main facade crate; the recommended starting point
creamui-reactive Signals and reactive effects
creamui-router Declarative routes, reactive hooks, browser and memory history
creamui-theme Default theme, light palette, and design tokens
creamui-core Widget, painter, scene, and layout abstractions
creamui-widgets Raw and themed components
creamui-image PNG, JPEG, and WebP image widgets
creamui-render Native windows and frame presentation
creamui-tray Optional native system-tray backends
creamui-devtools Development-only FPS/frame-time/CPU/RAM overlay (F3)
creamui-macros / creamui-jsx JSX syntax and component support
creamui-abi, creamui-ffi, creamui-dynamic Optional dynamic-runtime and C ABI integration

License

CreamUI is licensed under Apache-2.0. It permits commercial, private, and open-source use.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening a pull request.

About

A native, reactive UI framework for Rust desktop, web & mobile applications.

Topics

Resources

Contributing

Stars

46 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages