Operad
A cross-platform GUI library for Rust.
Features
- Simple, renderer-neutral API.
- Retained UI tree with flexible layout.
- Built-in widgets and editor controls.
- Type-safe actions and commands.
- Accessibility and input handling.
- WGPU renderer support.
- Custom drawing surfaces.
- Headless testing utilities.
Overview
The shortest path to a native window is run:
use ;
The runner opens the window, creates the renderer, lays out the document, and
routes input. Use run_app when widget actions should update application state;
the showcase example is a compact app built that way.
Web apps use the same retained document contract through the web-runtime
feature:
pub async
For custom WGPU drawing, add a GPU canvas to the document and register a canvas renderer:
let mut canvases = new;
canvases.register;
run_app_with_canvas_renderers?;
The renderer callback gets the canvas texture context, so it can record normal WGPU command buffers and render passes before Operad composites the UI.
Install
Feature Flags
widgets: widget helpers.native-window: native winit/WGPU windows.web-runtime: WASM/WebGPU runtime entry points with cosmic-text layout measurement.web-showcase: web runtime plus showcase widgets.wgpu: WGPU rendering.accesskit-winit: AccessKit support for winit hosts.text-cosmic: cosmic-text measurement and shaping.egui: egui host/input compatibility.egui-renderer-compat: egui renderer compatibility.audit: audit helpers.
Examples
Open a native window:
Starter templates are checked as ordinary examples:
For the web template, build minimal_web for wasm32-unknown-unknown, run
wasm-bindgen, and serve web/minimal.
Development Checks
Use the fast gate while iterating:
That runs formatting, locked all-target/all-feature compilation, all-feature library tests, and the locked no-default compile gate without running perf smoke or WGPU snapshot integration tests.
Focused cargo aliases are available for common loops:
Run the full local gate before release-level handoff:
That adds the full all-feature test suite and the supported WASM showcase check
for wasm32-unknown-unknown.
The release flow lives in docs/release_process.md.