About this project

rui is a declarative interface library for Rust designed to consolidate the three pillars of web development—structure, style, and behavior—into a single Rust expression. Unlike frameworks that rely on external rendering engines or heavy dependency trees, rui is entirely self-contained. It bundles its own TrueType parser, glyph rasterizer, antialiasing, text layout, and PNG writer, ensuring that an interface renders identically across macOS, Windows, Linux (X11/Wayland), and WebAssembly because the same code draws every pixel. The library adopts a functional approach where the view is a pure function of state, and event handlers are functions that mutate state directly, eliminating the need for interior mutability patterns like `Rc` or `RefCell`. Styling is integrated directly into the component chain via method calls (e.g., `.pad()`, `.center()`, `.hover_fill()`), and colors are defined by semantic roles (e.g., `Tone::Surface`) that resolve against the active theme. This ensures consistent appearance across light and dark modes without separate stylesheets. rui follows a "foundations, not a catalogue" philosophy. It does not ship with pre-built complex widgets like checkboxes or sliders. Instead, it provides seven powerful primitives (such as `draw`, `on_drag`, and `ease`) that allow developers to compose these controls themselves. This approach ensures that UI components are customizable and free from the constraints of a rigid widget library. Built-in elements like `button`, `text`, and `row` are themselves recipes built on these primitives, serving as reference implementations. Accessibility is a core architectural pillar. The element tree doubles as the accessibility tree, automatically deriving roles, names, and states from the UI structure. This ensures that screen readers and assistive technologies receive accurate information without requiring manual annotation. The library enforces accessibility conventions through rigorous testing, ensuring that interactive elements have proper identities and that focus management is consistent. Testing is supported by a deterministic `Harness` that drives the real rendering pipeline in a headless environment. It allows for precise assertions on layout, pixel output, and interaction states. A synthetic test font is used to ensure that text measurements are consistent across different machines, enabling reliable integration and parity tests.