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
110 downloads per month
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:
- platform: Core platform abstraction layer that handles windowing, events, and rendering
- draw: Drawing primitives and utilities for 2D rendering
- 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