Skip to content
xlsPublic

Repository files navigation

renderfi

Write your own markup, or plain HTML. Build the UI with CSS. Ship it as a native app that starts fast, uses little memory and draws on the GPU.

Status: pre-release Rust 1.90 or newer License: MIT No dependencies from crates.io A hello app is a 5.2 MB binary The docs are tested Live demos in the browser (WebGPU)
Platforms: Linux, Windows, macOS, iOS, Android, Web GPU: Vulkan, Direct3D 12, Metal, WebGPU
Bindings: C, C++, Python, Swift, AngelScript, TypeScript

The showcase app in the Tokyo skin: the glass demo, a frosted panel over moving CSS art, with its CSS in a live editor

www.renderfi.com · Live demos in your browser (needs WebGPU: a current Chrome, Edge, Safari or Firefox)

Why · Features · Performance · Live demos · Gallery · Quick start · Architecture · Profiler and inspector · For AI agents · What is missing · The guide

Why renderfi

The web's way to build a UI, without the browser. You know HTML, CSS and React. renderfi takes the same skills: markup like HTML, real CSS (Flexbox, Grid, :has(), @container, @layer, transitions, keyframes), components with props and slots, and reactive state in signals. What you do not ship is a browser. A hello window takes 43 MB of memory where Electron takes 717 MB, and the app is one file of 7.2 MB where Electron ships 287 MB.

Fast where apps get slow. In a 100,000-line document a typed key costs 0.21 ms (Electron: 99 ms, egui: 41 ms). A new label in a list of 1,000 rows takes 3.2 µs to lay out and 3.2 µs to record. An idle renderfi app draws no frames: in the benchmark it used no CPU time in 10 seconds.

Made for AI agents that port web apps. The main purpose of renderfi: an AI agent takes a web app (HTML and CSS, or React) and makes it a native app. The parity matrix says, feature by feature, what of the web is there, with a test as proof. Every code example in the docs comes from a file that is compiled and run, so an agent can trust what it reads. Skills for Claude Code give the procedures, and the inspection protocol lets an agent read and drive a running app as text.

One spec, every language. The C API is generated from one spec file, spec/renderfi.rfspec, and so are the bindings for C, C++, Python, Swift, AngelScript and JavaScript/TypeScript. Build the UI from markup and CSS, or from code with the same node API. Events need no callbacks: a press on <button on-click="save"> queues the action save, and your loop reads it on the next frame.

The GPU on every platform. Vulkan on Linux and Android, Direct3D 12 on Windows, Metal on macOS and iOS, WebGPU in the browser. A default build has only the GPU renderers. A CPU renderer is an opt-in feature (cpu-renderer), for tests and as a fallback on machines without a GPU.

Nothing from crates.io. The Cargo.lock of the workspace lists no crate from crates.io. Text shaping, the image decoders, the window code and the GPU backends are written in this repository.

renderfi is not released yet. The APIs change freely before 1.0.

Features

Layout and CSS

  • The cascade with @layer, @container, @supports, @media, @property, nesting, :has(), :is(), :where() and custom properties (css.md).
  • Flexbox, Grid with subgrid, position: sticky, columns, contain and content-visibility (css.md).
  • Anchor positioning: anchor(), position-area, @position-try (css.md).
  • Writing modes and the logical properties (css.md).
  • Paint: gradients, shadows, filters, backdrop-filter, 2D and 3D transforms (css.md); clip-path shapes (path(), shape(), polygon()), masks, blend modes; border-image (css.md); SVG painted by CSS (css.md).
  • Generated content: counters, @counter-style, ::marker (css.md).
  • Newer value functions: color-mix(), relative colors, light-dark(), attr() with types, if(), sibling-index(), progress(), contrast-color() (css.md).
  • An HTML preset: div, p, h1, a, ul and the other common elements, with the browser's defaults. Tables map to Grid. Floats and quirks mode are left out on purpose (porting-from-the-web.md).

Widgets and skins

More than 30 widgets, all styled by CSS
  • Forms: button, select, combo-box, slider, number field, checkbox, toggle, radio group, segmented control, search and password fields, color, date and time pickers (widgets.md).
  • Structure: menus and a menu bar, context menus, dialogs, drawers, toasts, tabs, accordion, toolbar, breadcrumbs, carousel, docking panels.
  • Data: tree view, a data grid for a million rows (data-grid.md), a property grid, charts and Markdown (charts-and-markdown.md), math from MathML or TeX (math.md).
  • Editors: a code editor with syntax colors, folding, many carets and a minimap (code-editor.md), rich text with contenteditable (rich-text.md), a node graph whose nodes are real UI (node-graph.md).
  • A terminal: <terminal command="bash"> runs a program on a pseudo terminal; without command it shows the bytes of your own transport (SSH, a serial port) and sends the keys out as actions (terminal.md). The examples examples/terminal and examples/ssh-client show the second mode.
  • Your own widgets: markup components, composite widgets, or native widgets that measure and paint in your code (native-widgets.md).
  • Skins: Harbor (like macOS), Slate (like Windows 11), Tokyo (the colors of Tokyo Night) and Mono, each with a dark and a light side, and a platform skin that picks the skin of the running system (skinning.md).
  • Components with props, slots and hot reload. A component has no node of its own, so the page's CSS reaches inside it, as with React; a scoped component keeps its own style, as a shadow root does (components.md).

State and data

  • Reactive state in signals: expressions in the markup, computed signals, two-way bind, lists. A write changes only the readers of that signal (state.md).
  • matchMedia in code, and media signals: media.phone stays true while a query holds, and markup reads it (css.md).
  • Routes and history with rf-router (navigation.md).
  • Async work with cancel tokens and promises, like AbortController (async.md).
  • Fetch, WebSockets, Server-Sent Events and localStorage in rf-net (networking.md).
  • A local database with live queries and crash-safe saving in rf-store (data-store.md).
  • Undo and redo, form validation (app-kit.md).

Motion and input

  • Transitions, keyframes, @starting-style, exit motion of removed nodes and layout glides (css.md).
  • Scroll-driven animations (scroll(), view(), animation-range) and motion paths (offset-path) (css.md, css.md).
  • View transitions (css.md).
  • Animation and transition events: on-animationend, on-transitionend and the others, as onAnimationEnd in React (css.md).
  • Gestures, motion values, and drag and drop inside the app (markup.md).
  • Touch and pens: a finger scrolls and flings, a tap clicks, a long press opens the context menu, two fingers pinch. touch-action and the media features pointer, hover, any-pointer and any-hover work as on the web (markup.md).
  • Scrolling with gliding wheels, touchpad flings, a rubber band and snapping (scrolling.md).
  • Virtual lists of any length, with rows of any height (virtual-lists.md).

Text and languages

  • Text shaping, right-to-left text, color emoji, font fallback, variable fonts, hinted and LCD text (css.md). On the web the browser draws the emoji and the scripts that the app's fonts lack.
  • Themes and languages that switch at run time (themes-and-languages.md).
  • Numbers, money, dates, relative time and plurals as JavaScript's Intl writes them, in 34 locales (locale-formatting.md).
  • Input methods (IME) for Chinese, Japanese, Korean and more (app-loop.md).
  • An accessibility tree with screen reader bridges: AT-SPI2 on Linux, UI Automation on Windows, NSAccessibility on macOS, and a DOM copy on the web.

Rendering

  • GPU backends: Vulkan, Direct3D 12, Metal and WebGPU; a CPU renderer as an opt-in fallback, the feature cpu-renderer (app-loop.md).
  • A frame draws only what changed: kept pieces of the display list, kept GPU buffers, and on Vulkan only the damaged pixels.
  • SVG, images (PNG, JPEG, WebP, GIF, TIFF, BMP, ICO, TGA, QOI, PSD, HDR, DDS), canvas drawing and 3D views (drawing.md).
  • Transparent windows and system materials, several windows, popups and pointer lock (app-loop.md).

Tools

  • An inspector: pick a node, see its styles, the box model, the accessibility tree and a console (inspecting.md).
  • A layout editor that changes the running app and writes back to the .rfml and .css files (editing-layouts.md).
  • A profiler with a GPU lane, and a memory view with live byte counts (memory.md).
  • Tests without a window: Ui::render_to_image, Ui::dump_tree and the test driver rf-testkit (testing.md).
  • A language server for RFML and CSS, and completion from the live type registry.

Scripting and bindings

  • A C API generated from the spec, with bindings for C, C++, Python and Swift (c-and-bindings.md).
  • Script hosts outside the core: AngelScript (scripting.md) and JavaScript/TypeScript on QuickJS (typescript.md). A TypeScript handler that writes 1,000 signals takes 0.2 ms.
  • TypeScript as Node and Deno run it: the types are erased, not checked. The subset is the one of tsc with erasableSyntaxOnly, so tsc --noEmit finds what the host refuses (typescript.md).
  • Live editing: --live shows a component beside its script in a code editor, and each change applies as you type (typescript.md).
  • Plugins in C, C++ or Rust, linked in or loaded from a folder with hot reload (plugins.md).

Platforms

platform window GPU notes
Linux Wayland, X11 Vulkan linux.md
Windows Win32 Direct3D 12 (WARP without a GPU) windows.md
macOS AppKit Metal macos.md
iOS, iPadOS UIKit (one window per scene) Metal touch, the keyboard on the screen with the field's hints, haptics, Core Text for emoji; scripts/build_ios.sh builds, signs and runs any app in a simulator or on a device; ios.md
Android NativeActivity and a small Java activity (one window) Vulkan touch, pinch, the keyboard on the screen with the field's hints, immersive mode, turning the device, haptics, AAudio, HTTPS and WebSockets, the document picker, sharing; scripts/build_android.sh builds and runs any app in the emulator or on a phone, no Gradle; android.md
Web a canvas in the page WebGPU hello world: 1.9 MB of wasm (0.7 MB gzipped); web.md

Small builds: pick the parts of the engine with Cargo features. A hello app is a 5.2 MB binary that needs 8 MB of memory (slim-builds.md).

Performance

bench/ compares renderfi with egui, Electron, Qt Quick and Slint in the same scripted scenarios, measured from outside the process (bench/README.md). All toolkits were built in release mode on the same day.

Machine: AMD Ryzen AI Max+ 395 laptop (Radeon 8060S), Linux, Wayland, 1280 x 800, vsync off. Medians. Run of 2026-11-27 (full tables); the chart row is from 2026-11-30 (perf-log.md).

renderfi egui Electron
hello window: resident memory 43 MB 111 MB 717 MB
hello window: file to ship 7.2 MB 11 MB 287 MB
hello window: idle wakeups per second 0.7 0.7 107
type a key in a 100,000-line editor 0.21 ms 41 ms 99 ms
100,000-line editor: resident memory 64 MB 2.2 GB 1.6 GB
move 500 cards with shadows, per frame 0.70 ms 1.5 ms 3.7 ms
4 live charts of 200 points, per frame 0.10 ms 0.17 ms 0.30 ms (2026-11-27)
start to first frame (warm) 190 ms 243 ms 240 ms
start to first frame, only the GPU's own driver 33 ms 63 ms

On this machine the installed NVIDIA Vulkan driver adds about 150 ms to the start of every Vulkan app, also when no NVIDIA GPU is there. The last row loads only the Radeon driver.

Inside the engine (from perf-log.md):

what time
a new label in a list of 1,000 rows: style and layout update 3.2 µs (139 µs before the incremental layout)
the same change: display list 3.2 µs (11 µs before; 22 nodes recorded instead of 134)
GPU frame with no change, drawn again (Vulkan, 34,809 nodes) 31 µs (1,240 µs before)
hover from row to row in the same UI 85 to 128 µs (1,300 µs before)
a signal write with one reader, and the flush 230 ns
the signal flush of an update with no write 20 ns
What the numbers do not say
  • With vsync off, a frame time is how fast a toolkit hands a frame over, not a frame on the screen. Electron's time is its main thread only; its GPU process works in parallel.
  • egui's own "work" time for the charts (0.02 ms) is only its UI pass, without tessellation and drawing. renderfi's 0.10 ms is the whole frame.
  • Qt Quick and Slint are in the full tables. Flutter was not installed on the machine.
  • Click-to-pixel latency is not measured.

Live demos

The live demos are on the website, www.renderfi.com. These apps run in the browser, built for WebAssembly and drawn with WebGPU. They are the same programs that run in a native window. A workflow builds them on each push to master (scripts/build_pages.sh). WebGPU is required: use a current Chrome, Edge, Safari or Firefox. On Linux, Chrome may need WebGPU turned on in chrome://flags.

demo what it shows
The showcase every demo, with its CSS in a live editor
Effects glass with backdrop-filter, blend modes, masks, a 3D card flip
Product viewer a PBR scene you turn and zoom (mouse or touch), with a glass panel over it
Game HUD a small game whose HUD is markup and CSS
Hello the smallest renderfi app for the web
3D modeler docking panels, glTF models and four views; open or drop glTF files, and Save downloads the scene

Gallery

Every picture comes from an app or an example of this repository, drawn headless on the GPU (Vulkan) at scale 2.

The modeler with the DamagedHelmet glTF sample in one large perspective view with Material shading, the outliner, the properties and the timeline The node graph app: nodes with sliders and a select inside, wires, a minimap
A 3D modeler (apps/modeler): the Khronos DamagedHelmet sample with material shading, docking panels, an outliner, properties and a timeline. A node graph (apps/nodegraph): the nodes are real UI with widgets inside; CSS styles the wires.
The buttons demo in the Tokyo skin: variants, gradient and glass buttons, icons, sizes and a floating action button The parallax demo: a night scene in layers with stars, a shooting star, a moon, mountains and fireflies
Buttons in the Tokyo skin: variants, gradient and glass, icons, shapes and sizes. Each variant is a class and a few rules. Parallax: a night scene in layers that move at different speeds. Only transforms and opacity change.
The CSS editor of the showcase with a completion list and the doc of the selected property, over the colour palette demo The rich text editor demo in the Tokyo skin: a toolbar and an editable document with a heading, a list and a quote
A code editor with completion. The list and the docs come from the live type registry (rf-complete). Above it, theme palettes that move from one to the next. Rich text editing (contenteditable) with a toolbar.
A dashboard with four tiles, sparklines, a live line chart with a tooltip, an area, a donut and a bar chart The dark and light demo: the same widgets on the dark and the light side of the Tokyo skin, side by side
A live dashboard with rf-charts: one new sample per frame (crates/rf-charts/examples/dashboard.rs). Dark and light: every skin has both sides; a class on a node picks the side for its subtree.
The profiler over the showcase with 500 spinning cubes: the gaps between frames split into their parts, CPU and GPU time per frame, the flame chart of one frame on the main thread and the GPU, the zone table and counters The inspector beside the showcase: the element tree with a text node selected, the node marked in the app with its size, and the CSS rules that match it with their file and line
The profiler over the showcase with 500 cubes, on Vulkan: the time between frames in parts, CPU and GPU time per frame, a flame chart of one frame, the zones and the counters. The inspector: the element tree, the selected node marked in the app, and the CSS rules that match it with their file and line.

Profiler and inspector

Both tools run inside your app, like the developer tools of a browser. One line puts them in, rf_app::tools::install(&mut ui);, or start the app with RF_TOOLS=1. Pictures of both are in the gallery.

The profiler (Ctrl+Shift+P, or RF_PROFILE=open to open it at the start) shows where the time of each frame goes: the time between frames in parts (wait, input, update, build, present), CPU and GPU time per frame against the 60 and 120 fps budgets, a flame chart per thread and for the GPU, a table of the zones, and counters such as draw calls and glyphs. Your own code adds zones with rf_trace::zone!. Read It is slow and memory.md for the memory view.

The inspector (Ctrl+Shift+I; Ctrl+Shift+C picks an element with the mouse) shows the element tree and marks the selected element in the app. Its tabs show the CSS rules that match, with their file and line, the computed values, the box model, the data bindings and signals, the animations and a console. A change to a style shows at once. An AI agent reads and drives the app the same way from a terminal with rf-inspect. Read inspecting.md.

Quick start

renderfi is not on crates.io. Clone the repository and run the apps; they draw with the GPU. The CPU renderer (fatmap) is the opt-in feature cpu-renderer: the tests use it, and so do pictures without a window. Get fatmap once before you run the tests or turn the feature on:

sh scripts/bootstrap.sh                  # fatmap, for the tests and cpu-renderer. Windows: scripts\bootstrap.cmd
cargo run --release -p showcase          # every demo, with its CSS to edit live
cargo run --release -p modeler           # a 3D modeler with docking panels
cargo run --release -p nodegraph         # the node graph
cargo run --release -p code              # a code editor that opens a folder

Rust

The UI is markup and CSS; the app loads it and writes a picture without a window. This code is from crates/renderfi/examples/guide_hello.rs:

// from: crates/renderfi/examples/guide_hello.rs#hello
const HELLO: &str = r##"
<box style="flex-direction: column; gap: 10; padding: 20; background-color: #1d1f23; color: #d8dbe0">
  <style>
    .title { font-size: 22; font-weight: bold }
    .btn { align-self: flex-start; padding: 6 14; border-radius: 4; background-color: #383b42; cursor: pointer }
    .btn:hover { background-color: #454953 }
  </style>
  <text class="title">Hello renderfi</text>
  <text text={msg}>Click the button.</text>
  <box class="btn" on-click="hello">Say hello</box>
</box>"##;

/// Load markup, lay it out and write a PNG. No window, no GPU.
pub fn hello_png(path: &Path) -> std::io::Result<()> {
    let mut ui = Ui::new();
    let root = ui.load_markup(HELLO).unwrap_or_else(|problems| {
        for p in &problems {
            eprintln!("markup {p}"); // "line:col: message"
        }
        panic!("the markup has errors");
    });
    ui.set_root(root).unwrap();
    ui.render_to_image(path, &renderfi::ImageOptions::new(480, 170))?; // logical size; the format comes from the extension
    println!("{}", ui.dump_tree()); // the layout as text
    for warning in ui.take_warnings() {
        eprintln!("warning: {warning}"); // bad CSS values and the like
    }
    Ok(())
}
cargo run --release -p renderfi --example guide_hello            # writes out/guide/hello.png
cargo run --release -p renderfi --example guide_hello -- window  # the same in a window

Python

The same idea through the binding that is generated from the spec. This code is from examples/python/hello.py:

# from: examples/python/hello.py#readme
lib_name = {"darwin": "librenderfi_c.dylib", "win32": "renderfi_c.dll"}.get(sys.platform, "librenderfi_c.so")
lib = rf.load(os.path.join(root, "target", "release", lib_name))

# a Context owns the context; its parts are objects (ui.styles, ui.data, ui.engine.plugins)
ui = rf.Context(lib)

markup = """
<box style="flex-direction: column; padding: 24; gap: 10; background-color: #1d1f23; color: #d8dbe0">
  <style> .title { font-size: 26 } .py { color: #ffd43b } </style>
  <text class="title">Hello from <b class="py">Python</b></text>
  <text>Every type and function here was generated from spec/renderfi.rfspec.</text>
  <repeat each={langs} style="flex-direction: row; gap: 8">
    <text text={item.name} style="padding: 4 10; border-radius: 4; background-color: #2f3238"/>
  </repeat>
</box>
"""
ui.set_root(ui.load_markup(markup))  # a markup error raises rf.RenderFiError

# a list signal: rows with a key and fields (the markup shows them in a repeat)
names = ["C", "Rust", "Python", "Swift", "C#"]
ui.data.set_list("langs", [(str(i), {"name": name}) for i, name in enumerate(names)])

out = os.path.join(root, "out", "hello_python.png")
os.makedirs(os.path.join(root, "out"), exist_ok=True)
ui.render_to_image(rf.RfRenderToImageInfo(path=out, width=640, height=200))  # PNG: from the extension
print("wrote", out)
cargo build --release -p rf-capi --features cpu-renderer && python3 examples/python/hello.py

The C, C++ and Swift versions are in c-and-bindings.md. To use renderfi in your own app, add path dependencies as the quick start of the guide shows. The web build is in web.md.

Architecture

          input (rf-platform: windows, keys, pointer, IME)
                │
                ▼
RFML + CSS ──► renderfi Ui (signals, events) ──► named actions ──► your app (Rust, C, C++, Python, Swift, scripts)
                │
                ├─ rf-markup     markup and CSS parser
                ├─ rf-core       node tree, values, style resolution
                ├─ rf-layout     Flexbox, Grid, block layout
                └─ rf-text       fonts, shaping, line breaks
                │
                ▼
          rf-render (display list, kept pieces, damage)
                │
                ▼
   rf-vulkan · rf-d3d12 · rf-metal · rf-webgpu · CPU (fatmap)
crate what it does
renderfi the core API: Ui, markup, CSS, signals, events, the display list
rf-core, rf-markup, rf-layout, rf-text the node tree and style resolution, the RFML and CSS parser, CSS layout (flex, grid, block), fonts and text shaping
rf-render and the GPU crates the display list, the CPU renderer, and the backends rf-vulkan, rf-d3d12, rf-metal, rf-webgpu
rf-platform, rf-app native windows and input; the loop that joins a window, a renderer and a Ui
rf-widgets and the optional crates widgets, rf-charts, rf-markdown, rf-math, rf-nodegraph, rf-terminal, rf-net, rf-store, rf-router, rf-intl, rf-audio, rf-video
rf-capi, rf-gen the C library, and the generator that makes the C header and every binding from spec/renderfi.rfspec

The core stays lean: new features go into optional crates and Cargo features. The decisions are in DESIGN.md.

For AI agents

The skills in .claude/skills give the procedures:

skill use it to
port-web-app port a web or React app, compare it with the browser, record the gaps
build-renderfi-app start an app in Rust or through a binding
test-and-debug headless tests, goldens, the profiler, the inspector
contribute-to-renderfi the rules of this repository

CLAUDE.md lists all of them. The inspection protocol (rf-inspect) lets an agent read and drive a running app as text (inspecting.md).

What is missing

  • iOS: runs (drawing, touch, audio, services); composing text with an input method, keyboard avoidance and VoiceOver are open (ios.md).

  • Android: runs on a phone and in the emulator (drawing, touch, the keyboard, sound, the network, files, haptics); keyboard avoidance, TalkBack and asking for permissions at run time are open (android.md).

  • Video: rf-video plays pictures in <video> (video.md); no sound yet, and only Linux has a system decoder (GStreamer).

  • CSS and the web platform: the parity matrix counts what is done (parity.md):

    part done partial missing
    CSS 126 18 16
    DOM and platform APIs 47 25 6
    library patterns (React and the like) 25 8 1

    Most of what is missing is hard and rare: masonry layout, Indic shaping, upright Chinese, Japanese and Korean in vertical text, SVG filters on nodes (filter: url()), ::highlight() and element.animate(). Each row says what to use instead.

The full list is in ROADMAP.md.

Documentation

document what is in it
the guide markup, CSS, widgets, state, the app loop, a cookbook; every example in it is tested
porting from the web what carries over from HTML, CSS and React, and what is different
parity.md each web feature and its status, with a test as proof
c-and-bindings.md the C API, C++, Python, Swift
platforms Linux, Windows, macOS, iOS, Android, the web
slim-builds.md Cargo features and binary sizes
DESIGN.md the architecture and the decisions
perf-log.md measured performance work

License

MIT, see LICENSE. The bundled Noto fonts are under the SIL Open Font License 1.1 (assets/fonts/OFL.txt).

Releases

Packages

Contributors

Languages