#mix #salt #events #boilerplate #layer #appearance #management #ui #wasm

mix

mix - a rust ui library cooked up in half a day! (expect extra salt)

5 releases

new 0.2.1 Apr 26, 2025
0.1.3 Jan 30, 2025
0.1.2 Jan 30, 2025
0.1.1 Feb 3, 2024
0.1.0 Feb 3, 2024

#137 in Graphics APIs

Download history 249/week @ 2025-01-28 29/week @ 2025-02-04 2/week @ 2025-02-18 12/week @ 2025-02-25 3/week @ 2025-03-04 1/week @ 2025-04-15 109/week @ 2025-04-22

110 downloads per month

MIT/Apache

100KB
3K SLoC

mix UI Library

mix is a high-performance UI library for Rust, inspired by Makepad's architecture but with a focus on simplicity and performance. mix provides a clean, modular API for building cross-platform user interfaces without the complexity of live rendering and compiler features.

Features

  • High Performance: Built with performance in mind, using efficient rendering techniques
  • Cross-Platform: Supports Windows, macOS, Linux, and Web (via WebAssembly)
  • Modular Architecture: Clean separation between platform, drawing, and widget layers
  • Simple API: Easy-to-use API for building UIs with minimal boilerplate
  • Customizable Theming: Flexible theming system for consistent UI appearance

Architecture

mix is organized into three main modules:

  1. platform: Core platform abstraction layer that handles windowing, events, and rendering
  2. draw: Drawing primitives and utilities for 2D rendering
  3. widgets: UI widgets and layout system

Getting Started

Add mix to your Cargo.toml:

[dependencies]
mix = "0.1.0"

Create a simple application:

use mix::Cx;
use mix::event::Event;
use mix::*;

struct MyApp {
    window: Window,
}

impl MyApp {
    fn new() -> Self {
        let mut cx = Cx::new();

        // Create a view with a label
        let mut content = View::new(&mut cx);
        content.add_child(Label::new(&mut cx, "Hello, mix!"));

        // Create window with content
        let window = Window::new(&mut cx, "My App")
            .with_content(content);

        Self { window }
    }
}

impl AppMain for MyApp {
    fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
        self.window.handle_event(cx, event);

        if let Event::Draw = event {
            let mut cx2d = Cx2d::new(cx);
            self.window.draw(&mut cx2d);
        }
    }
}

app_main!(MyApp);

Examples

Check out the examples directory for more examples:

  • hello_world: A simple Hello World application
  • counter: A counter application demonstrating state management
  • todo_list: A todo list application demonstrating more complex UI

License

MIT or Apache-2.0, at your option.

Dependencies

~1–35MB
~491K SLoC