# vgtk
**Repository Path**: mirrors_berkus/vgtk
## Basic Information
- **Project Name**: vgtk
- **Description**: A declarative desktop UI framework for Rust built on GTK and Gtk-rs
- **Primary Language**: Unknown
- **License**: LGPL-3.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-10-22
- **Last Updated**: 2026-05-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# vgtk
A declarative desktop UI framework for Rust built on [GTK](https://www.gtk.org/) and [Gtk-rs].
## At A Glance
- A clean, functional component model inspired by the
[Elm architecture](https://guide.elm-lang.org/architecture/), [Redux](https://redux.js.org/) and
[Yew](https://github.com/yewstack/yew).
- A declarative DSL for composing GTK widgets inspired by [React](https://reactjs.org/) and
[JSX](https://reactjs.org/docs/introducing-jsx.html), using virtual "DOM" diffing for efficient
updates.
- Fully cross platform with a native look and feel for Linux, Windows and macOS.
- Built on Rust's [`Future`](https://doc.rust-lang.org/std/future/trait.Future.html)s using
[GLib](https://developer.gnome.org/glib/stable/)'s event loop, giving you
[async/await superpowers](https://rust-lang.github.io/async-book/) cleanly integrated with the
GTK event model.
- Absolutely no need for an embedded browser engine, unless you
[really want one](https://webkitgtk.org/).
## Documentation
- [API docs (latest release)](http://vgtk.rs/)
- [Tutorial](https://bodil.lol/vgtk/)
## Show Me!
```rust
use vgtk::{ext::*, gtk, run, Component, UpdateAction, VNode};
use vgtk::lib::{gtk::*, gio::ApplicationFlags};
#[derive(Clone, Default, Debug)]
struct Model {
counter: usize,
}
#[derive(Clone, Debug)]
enum Message {
Inc,
Exit,
}
impl Component for Model {
type Message = Message;
type Properties = ();
fn update(&mut self, message: Message) -> UpdateAction {
match message {
Message::Inc => {
self.counter += 1;
UpdateAction::Render
}
Message::Exit => {
vgtk::quit();
UpdateAction::None
}
}
}
fn view(&self) -> VNode {
gtk! {
}
}
}
fn main() {
std::process::exit(run::());
}
```
## Installation
You'll need to ensure GTK is installed and usable on your system before you can use `vgtk`. Please
consult the [Gtk documentation](https://www.gtk.org/docs/installations/) for detailed
instructions. It can be especially involved on Windows, but if you follow their instructions
carefully, it does eventually work.
## Getting Started
You can use [`cargo generate`](https://github.com/ashleygwilliams/cargo-generate) to start a `vgtk`
project:
```sh
cargo generate --git https://github.com/bodil/cargo-template-vgtk
```
Alternatively, if you don't want to install `cargo generate`, you can clone the
[template repo](https://github.com/bodil/cargo-template-vgtk) and edit the `Cargo.toml` file
manually to fit your project.
To run your app, enter the project folder and type `cargo run`, and marvel at the little window
which eventually appears and what wonders you could fill it with.
## Examples
See the [examples](examples) folder for a collection of example applications, including a complete
[TodoMVC](examples/todomvc) implementation. To try out the TodoMVC example, clone the `vgtk` repo
and issue `cargo run --bin todomvc` from the project root directory.
## Licence
This program is free software: you can redistribute it and/or modify it under the terms of the GNU
Lesser General Public Licence as published by the Free Software Foundation, either version 3 of the
Licence, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
General Public Licence for more details.
You should have received a copy of the GNU Lesser General Public Licence along with this program. If
not, see .
[gtk-rs]: https://gtk-rs.org/