A declarative desktop GUI framework for the Rust programming language.
- Build desktop applications which look and behave the same for Windows, Mac, and Linux.
- Write GUI code in a declarative way in pure Rust (no DSL macros).
- Views derive from application state. Change the state and the views which bind to it update automatically.
- Create flexible layouts which adapt to changes in size. Powered by morphorm.
- Take advantage of stylesheets with hot-reloading to fully customize the look of your application.
- Bring your applications to life with animations.
- Utilize over 25 ready-made views as well as two built-in themes (light and dark) to get you started. Includes 4250+ SVG icons, provided by Tabler Icons.
- Make your applications accessible to assistive technologies such as screen readers, powered by accesskit.
- Adapt your application to different locales, including translating text with fluent.
- Vizia leverages the powerful and robust skia library for rendering, with further optimizations to only draw what is necessary.
- Vizia provides an alternative baseview windowing backend for audio plugin development, for example with the nih-plug framework.
Explore all of the built-in views in the widget gallery. Run with:
cargo run --release -p widget_galleryA simple counter application. Run with cargo run --example counter.
use vizia::prelude::*;
// Define some model data
pub struct AppData {
count: Signal<i32>,
}
// Define events to mutate the data
pub enum AppEvent {
Increment,
}
// Describe how the data is mutated in response to events
impl Model for AppData {
fn event(&mut self, _: &mut EventContext, event: &mut Event) {
event.map(|app_event, _| match app_event {
AppEvent::Increment => {
self.count.update(|count| *count += 1);
}
});
}
}
fn main() {
// Create an application
Application::new(|cx| {
let count = Signal::new(0);
// Build the model data into the tree
AppData { count }.build(cx);
// Declare views which make up the UI
HStack::new(cx, |cx| {
// Declare a button which emits an event
Button::new(cx, |cx| Label::new(cx, "Increment"))
.on_press(|cx| cx.emit(AppEvent::Increment));
// Declare a label which is bound to part of the model, updating when it changes
Label::new(cx, count).width(Pixels(50.0));
})
.alignment(Alignment::Center) // Apply style and layout modifiers
.horizontal_gap(Pixels(50.0));
})
.title("Counter") // Configure window properties
.inner_size((400, 100))
.run();
}A guide book for vizia is available here.
Auto-generated code documentation can be found here.
A list of examples is included in the repository.
To run an example:
cargo run --release --example name_of_exampleTThere are also example applications which are packages with their own Cargo.toml files. To run, for example, the widget gallery, use the following command:
cargo run -p widget_galleryWhere widget_gallery should be replaced with the name of the example package you wish to run.
The Vizia project welcomes contributions from developers of all experience levels! Whether you’re interested in:
- Reporting bugs in the framework or examples
- Improving documentation and examples
- Adding features or optimizations
- Fixing issues or reviewing pull requests
- Writing custom widgets or extensions
All contributions are valuable.
For help with vizia, or to get involved with contributing to the project, come join us on our discord.
Vizia is licensed under MIT.
Vizia logo designed by Lunae Somnia.