Skip to content

Drew-Chase/aurora-ui

Repository files navigation

AuroraUI

A GPU-accelerated, feature-gated UI framework for building fast, lightweight desktop applications in Rust.

Features · Quick Start · Feature Flags · Architecture


Warning

This framework is still in development and is not ready for production use. Use at your own risk.

AuroraUI is a cross-platform desktop UI framework that treats performance as a first-class constraint — not an afterthought. Every subsystem (text rendering, widgets, animation, accessibility) is behind a feature gate. You pay only for what you use, in both binary size and startup time.

use aurora_ui::prelude::*;

fn main() {
	App::new()
		.title("Hello, Aurora")
		.size((400, 300))
		.font(include_bytes!("Roboto-Regular.ttf"))
		.run(|window, _frame| {
			window.root(
				col!()
					.spacing(10.0)
					.align(Align::Center)
					.justify(Justify::Center)
					.child(Text::new("Hello, world!").font_size(24.0))
					.child(
						button!("Click me")
							.on_click(|_| println!("clicked")),
					),
			);
		})
		.expect("Failed to run app");
}

Why AuroraUI?

Problem Aurora's Answer
Electron/Tauri apps are slow to start Feature-gated architecture keeps startup fast — load only what you need
Qt/GTK bundles are large Minimal binary with aggressive feature gating — don't need text? Don't ship a font shaper
No framework does custom titlebars right Native Win11 rounded corners, drop shadows, and snap layouts. macOS traffic lights with fullSizeContentView. Linux CSD.
Frameworks force you to bundle everything Feature-gated architecture. Every subsystem is opt-in.

Features

  • Pluggable GPU backends — Software (softbuffer), OpenGL 3.3 (glow), and Vulkan/Metal/DX12 (wgpu) — swap with a feature flag, zero code changes
  • Custom window titlebars — Windows 11 DWM rounded corners, drop shadow, and edge-resize via WM_NCHITTEST subclassing
  • Multi-window supportWindowConfig builder, window.open_window(), modal dialogs, cross-window messaging, parent-child relationships
  • Feature-gated text rendering — Font loading, shaping, and text widgets behind text feature flag
  • Layout systemcol! and row! macros with flex alignment, Stack, Positioned, and ScrollView
  • Image and SVG support — PNG/JPEG decoding, SVG rasterization with gradient support, feature-gated
  • Composite widget macro#[composite_widget] generates builder setters, new(), and impl Widget from a config struct
  • Iconify integrationaurora_iconify fetches icons from iconify.design at compile time with type-safe access
  • Incremental rendering — Dirty-flag system skips unchanged subtrees
  • Built-in benchmarkingjust benchmark reports binary size, startup time, and memory for every example
  • Statically linked binaries — Single executable, no runtime dependencies

Quick Start

AuroraUI is not yet published to crates.io. To use it, clone the repository and reference it as a path dependency:

# Cargo.toml
[dependencies]
aurora_ui = { path = "path/to/aurora-ui/aurora" }

The default feature set includes the software rendering backend. To also enable text rendering and widgets that depend on it:

[dependencies]
aurora_ui = { path = "path/to/aurora-ui/aurora", features = ["software", "text"] }

To use GPU-accelerated presentation instead (OpenGL or Vulkan/Metal/DX12):

# OpenGL 3.3 — fast startup, broad compatibility
aurora_ui = { path = "path/to/aurora-ui/aurora", features = ["opengl", "text"] }

# Vulkan/Metal/DX12 — best per-platform rendering
aurora_ui = { path = "path/to/aurora-ui/aurora", features = ["wgpu_backend", "text"] }

No code changes needed — just swap the feature flag.

Feature Flags

GPU Backends (pick one)

Feature Backend Binary impact Default
software softbuffer (GDI/CPU) ~0 KB Yes
opengl glow (OpenGL 3.3) ~200 KB No
wgpu_backend wgpu (Vulkan/Metal/DX12) ~2 MB No

When multiple backends are enabled, priority is: wgpu > opengl > software.

Content Features

Feature What it adds Default
text Font loading, shaping, text widgets, buttons No
image PNG/JPEG decoding and Image widget No
svg SVG parsing, rasterization, and Svg widget No
animate Tweens, easing, keyframes, timelines No
a11y Screen reader support via AccessKit No
i18n Locale detection, fluent-rs messages, formatting, lang! compile-time TOML No
i18n-icu Full ICU4X formatting (comprehensive locale coverage) No

Performance

Release-mode benchmarks on Windows 11 (just benchmark):

Example Binary (KB) Startup (ms) Memory (KB)
button_example 1,780 75.86 21,312
counter_example 1,628 99.82 18,464
custom_titlebar_example 385 78.46 34,260
image_example 1,252 83.62 22,296
layout_example 387 83.40 20,304
minimal_example 374 128.55 20,224
scrollview_example 394 87.48 20,248
text_example 1,769 107.79 21,396
text_input_example 1,640 100.35 19,152

The minimal blank-window binary is 369 KB. Text rendering (text feature) adds ~1.4 MB. Image decoding (image feature) adds ~870 KB. All examples start in under 115 ms with ~33 MB working set.

Run just benchmark to reproduce these numbers on your machine.

Architecture

AuroraUI is structured as a Cargo workspace of focused, single-responsibility crates. This gives fast incremental compilation (~1-3s for widget changes) and clean dependency boundaries.

aurora/
├── aurora_core       # Zero-dep types: color, geometry, events, IDs
├── aurora_platform   # Windowing, event loop, native handles, custom titlebar
├── aurora_gpu        # GPU abstraction: softbuffer, glow (OpenGL), wgpu (Vulkan/Metal/DX12)
├── aurora_render     # 2D drawing: rounded rects, paths, images
├── aurora_text       # Text shaping, layout, font management (optional)
├── aurora_layout     # Layout engine (planned)
├── aurora_widgets    # Widget library: layout, composites, interactables
├── aurora_macros     # Proc macros: #[composite_widget], #[derive(CompositeWidget)]
├── aurora_iconify    # Compile-time icon embedding from iconify.design
├── aurora_theme      # Theming system (planned)
├── aurora_animate    # Animation: tweens, easing, keyframes, timelines, presets
├── aurora_a11y       # Accessibility via AccessKit
├── aurora_i18n       # Internationalization: locale, fluent-rs, formatting (optional)
└── aurora (facade)   # Public API — re-exports everything

Custom Titlebar

Aurora provides first-class support for custom window chrome that respects platform conventions:

Windows 11 — DWM frame extension with DWMWA_WINDOW_CORNER_PREFERENCE for native rounded corners, WM_NCHITTEST for snap layout support on the maximize button, and automatic drop shadow via DwmExtendFrameIntoClientArea.

macOStitlebarAppearsTransparent with fullSizeContentView style mask. Traffic light buttons are automatically positioned within your custom titlebar content.

Linux — Client-side decorations on Wayland (deferred).

Custom Widgets

Aurora provides two ways to build reusable widgets:

Composite Widgets (recommended)

Use #[composite_widget] to compose existing widgets with builder-pattern ergonomics. Define a config struct, implement CompositeBuilder, and the macro generates new(), setters, and the full Widget impl.

#[composite_widget]
pub struct MyCard {
    pub width: u32,
    pub background_color: Color,
    #[composite(skip)]
    pub on_click: Option<Box<dyn FnMut()>>,
}

impl CompositeBuilder for MyCard {
    fn build(&self) -> Box<dyn Widget> {
        Box::new(BoxWidget::new()
            .width(self.width)
            .background_color(self.background_color))
    }
}

// Usage:
MyCard::new().width(200).background_color(Color::RED)

Field attributes: #[composite(rename = "bg")], #[composite(skip)], #[composite(into)], #[composite(with_types = "impl Into<String>")].

Full Widgets

Implement the Widget trait directly for complete control over layout, painting, and event handling. See examples/custom_widget/ for a side-by-side comparison.

Button

The Button widget accepts any child content via .child() or the button! macro:

// Text button (requires text feature):
button!("Click me").on_click(|e| println!("clicked"))

// Any widget as child:
button!(my_icon_widget).on_click(|e| { ... })

// Full builder:
Button::new()
    .child(my_widget)
    .width(200)
    .height(50)
    .background_color(Color::RED)
    .on_click(|e| { ... })
    .on_hover(|hovering| { ... })

Iconify Icons

The aurora_iconify crate fetches icons from iconify.design at compile time. Over 200,000 icons from 150+ icon sets are available.

[dependencies]
aurora_iconify = { path = "crates/aurora_iconify" }
// Declare which icon sets to include (fetched at compile time):
aurora_iconify::icon_sets!("mage", "lucide");

// Type-safe access — one method per icon:
let svg: &str = Icon::mage().calendar_2_fill();

// Dynamic access by name:
let svg: Option<&str> = Icon::mage().by_name("calendar-2-fill");

// Dynamic set + name:
let svg = Icon::from_set("mage").and_then(|s| s.by_name("calendar-2-fill"));

Icon data is cached locally for 7 days. All SVGs are embedded directly in the binary as &'static str.

Accessibility

Aurora UI integrates with AccessKit to expose the widget tree to platform accessibility APIs (Windows Narrator/NVDA, macOS VoiceOver, Linux Orca). Enable the a11y feature flag:

aurora_ui = { version = "0.1", features = ["software", "text", "a11y"] }

All 52 built-in widgets declare semantic roles, labels, values, and states automatically. Custom widgets can participate by overriding access_info() on the Widget trait:

#[cfg(feature = "a11y")]
fn access_info(&self) -> aurora_a11y::NodeInfo {
    aurora_a11y::NodeInfo::new(aurora_a11y::accesskit::Role::Button)
        .with_label("Submit")
}

See the Accessibility wiki page for the full guide.

Platform Support

Platform software (GDI) opengl (GL 3.3) wgpu (Vulkan/Metal/DX12)
Windows 10/11 Primary Supported Supported (DX12)
macOS 11+ Primary Supported Supported (Metal)
Linux (X11) Supported Supported Supported (Vulkan)
Linux (Wayland) Supported Supported Supported (Vulkan)

Building from Source

git clone https://github.com/yourusername/aurora-ui.git
cd aurora-ui

# Run the minimal example (blank window)
cargo run -p minimal

# Run the counter example (requires text feature)
cargo run -p counter_example --features text

# Build a release binary and check size
cargo build --release -p minimal

Development Setup

For fast iteration, install a faster linker:

# Linux — install mold
sudo apt install mold

# macOS — lld comes with Xcode command line tools

# Windows — lld comes with Visual Studio

The workspace's .cargo/config.toml is preconfigured to use the fast linker. Incremental dev builds of widget code should take 1-3 seconds.

Contributing

AuroraUI is currently a solo project in active development. Issues and discussions are welcome. If you're interested in contributing, the most impactful areas are:

  • Platform testing — especially Linux compositors, multi-monitor HiDPI setups, and Windows accessibility
  • Widget implementations — new widgets following the existing patterns
  • Examples and documentation — real-world usage examples

About

A GPU-accelerated, feature-gated UI framework for building fast, lightweight desktop applications in Rust. Custom Win11/macOS titlebars. ~1.2 MB minimal binary. Sub-100ms startup.

Topics

Resources

Contributing

Stars

Watchers

Forks

Contributors