Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vizia/vizia
A declarative GUI library written in Rust
https://github.com/vizia/vizia
application binding css declarative-ui desktop framework graphical-user-interface graphics gui reactive rust skia toolkit ui user-interface
Last synced: 24 days ago
JSON representation
A declarative GUI library written in Rust
- Host: GitHub
- URL: https://github.com/vizia/vizia
- Owner: vizia
- License: mit
- Created: 2021-09-17T00:32:49.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T15:22:30.000Z (about 2 months ago)
- Last Synced: 2024-10-02T01:41:48.169Z (about 1 month ago)
- Topics: application, binding, css, declarative-ui, desktop, framework, graphical-user-interface, graphics, gui, reactive, rust, skia, toolkit, ui, user-interface
- Language: Rust
- Homepage: https://docs.vizia.dev
- Size: 7.87 MB
- Stars: 1,580
- Watchers: 11
- Forks: 66
- Open Issues: 45
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-2d-graphics-rendering - vizia
- awesome-rust-list - Vizia
- awesome-rust-list - Vizia
README
Vizia
A declarative desktop GUI framework for the Rust programming language.
# Features
- ### __Cross-platform (Windows, Linux, MacOS)__
Build desktop applications which look and behave the same for Windows, Mac, and Linux.
- ### __Declarative__
Write GUI code in a declarative way in pure Rust (no DSL macros).
- ### __Reactive__
Views derive from application state. Change the state and the views which bind to it update automatically.
- ### __Flexible layout__
Create flexible layouts which adapt to changes in size. Powered by [morphorm](https://github.com/vizia/morphorm).
- ### __Powerful styling__
Take advantage of stylesheets with hot-reloading to fully customize the look of your application.
- ### __Animations__
Bring your applications to life with animations.
- ### __Built-in views and themes__
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](https://tabler-icons.io).
- ### __Accessibility__
Make you applications accessible to assistive technologies such as screen readers, powered by [accesskit](https://github.com/accesskit/accesskit).
- ### __Localization__
Adapt your application to different locales, including translating text with [fluent](https://github.com/projectfluent/fluent-rs).
- ### __Optimised rendering__
Vizia leverages the powerful and robust [skia](https://github.com/rust-skia/rust-skia) library for rendering, with further optimizations to only draw what is necessary.
- ### __Audio plugin development__
Vizia provides an alternative [baseview](https://github.com/RustAudio/baseview) windowing backend for audio plugin development, for example with the [nih-plug](https://github.com/robbert-vdh/nih-plug) framework.
# At a Glance
A simple counter application. Run with `cargo run --example counter`.
```rust, no_run
use vizia::prelude::*;// Define some model data
#[derive(Lens)]
pub struct AppData {
count: 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 += 1;
}
});
}
}fn main() {
// Create an application
Application::new(|cx| {// Build the model data into the tree
AppData { count: 0 }.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, AppData::count).width(Pixels(50.0));
})
.child_space(Stretch(1.0)) // Apply style and layout modifiers
.col_between(Pixels(50.0));
})
.title("Counter") // Configure window properties
.inner_size((400, 100))
.run();
}
```# Learning
## Book
A quickstart guide for vizia is available [here](https://book.vizia.dev).
## Docs
Auto-generated code documentation can be found [here](https://docs.vizia.dev).
## ExamplesA list of [examples](https://github.com/vizia/vizia/tree/main/examples) is included in the repository.
To run an example with the [winit](https://github.com/rust-windowing/winit) (default) windowing backend:
```bash
cargo run --release --example name_of_example
```### Baseview
To run an example with the [baseview](https://github.com/RustAudio/baseview) windowing backend:
```bash
cargo run --release --example name_of_example --no-default-features --features baseview
```# Contributing and Community
For help with vizia, or to get involved with contributing to the project, come join us on [our discord](https://discord.gg/aNkTPsRm2w).# License and Attribution
Vizia is licensed under [MIT](https://github.com/vizia/vizia/blob/main/LICENSE).Vizia logo designed by [Lunae Somnia](https://github.com/LunaeSomnia).