The state of Rust GUI libraries
Tags: rust, webdev
Published: 2022-08-17 14:39:00

**Written by [Solomon Esenyi](https://blog.logrocket.com/author/solomonesenyi/)✏️**

Graphical user interfaces (GUIs) provide an intuitive visual frontend for interacting with computers. GUIs use visual indicators like icons, windows, and menus for better user interaction and experience, unlike command-line interfaces (CLIs) that use text for input and output operations. 

Rust has been growing in popularity over time, likely due to its flexibility and vibrant open source community. Developers have used Rust for things like systems design, web development, and building GUIs. You can use many packages and crates to develop fast, complex GUI applications in Rust. 

In this article, we’ll talk about popular Rust GUI libraries and frameworks like `gtk-rs`, `fltk-rs`, `iced`, `relm`, Azul, and `egui`. We’ll also compare these GUI libraries and discuss how they’re a good choice for building your GUI application. 

Let’s get started!

*   [The `gtk-rs` library](#gtk-rs-library)
*   [The `fltk-rs` crate](#fltk-rs-crate)
*   [The `iced` library](#iced-library)
*   [The `relm` library](#relm-library)
*   [The Azul framework](#azul-framework)
*   [The `egui` library](#egui-library)
*   [Comparing Rust GUI libraries](#comparing-rust-gui-libraries)

## The `gtk-rs` library <a name="gtk-rs-library">

GTK is a popular cross-platform, object-oriented widget toolkit developed by [The GNOME Project](https://en.wikipedia.org/wiki/The_GNOME_Project). It’s used for building portable GUI applications that work on Unix, Windows, and macOS systems in a number of languages, from Python to JavaScript, C, and Rust. 

There are various versions of the GTK project, such as GTK 3, with changes and upgrades to each version. 

The [`gtk-rs` project](https://gtk-rs.org/) provides safe Rust bindings for GNOME stack-based libraries, like the GTK 3 and GTK 4 libraries. The [`gtk3-rs`](https://github.com/gtk-rs/gtk3-rs) and [`gtk4-rs`](https://github.com/gtk-rs/gtk4-rs) libraries provides GTK 3 and GTK 4 functionalities, respectively. ![Gtk-rs Library](https://blog.logrocket.com/wp-content/uploads/2022/08/gtk-rs.jpeg) 

To get started using the `gtk-rs` libraries, you need the Rust toolchain and the GTK library. After creating a project, add the library to your dependencies in the `Cargo.toml` file for the GTK 4 crate:

```rust
gtk = { version = "X.X", package = "gtk4" }
```

If you’re on macOS or Linux, install the GTK 4 library using the brew package manager:

```shell
brew install gtk4
```

Check these pages for installation instructions on the various [Linux Distros](https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_linux.html) and [Windows](https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_windows.html). After installing `gtk4` and adding it to your dependencies, you can import the crate like this:

```rust
use gtk::prelude::*;
use gtk::Application;
```

[The gtk-rs book](https://gtk-rs.org/gtk4-rs/stable/latest/book/introduction.html) is a good resource for learning how to build GUIs in Rust using the library. 

The GTK library is popular in the developer community. Many popular Linux GUI applications use the GTK library and GNOME stack. The `gtk-rs` library is just one of the many Rust GUI libraries ready for production and has been used in more than 500 projects.

## The `fltk-rs` crate <a name="fltk-rs-crate">

[FLTK (Fast Light Toolkit)](https://www.fltk.org/) is a lightweight, cross-platform supported toolkit for building GUIs. FLTK is supported on Windows, macOS, and UNIX systems and was originally built for C++. If you use the FLTK toolkit to create a GUI application, the application looks the same on all supported operating systems. 

[The `fltk-rs` library](https://github.com/fltk-rs/fltk-rs) provides Rust bindings for the FLTK toolkit. The `fltk-rs` crate supports old architecture with more than 80 customizable widgets and more than four supported theme schemes, including the GTK scheme. You can also use [the `fltk-theme` crate](https://crates.io/crates/fltk-theme) for more customizations. ![Fltk-rs Crate](https://blog.logrocket.com/wp-content/uploads/2022/08/fltk-rs.jpeg) 

The `fltk-rs` library is quick to install, build, start, and run with a single execution. Getting started with the `fltk-rs` crate is easy – all you have to do is add the project as a dependency to your `Cargo.toml` file and install the library on your computer. 

You can install the `fltk` library using this brew command if you're on a macOS or Linux computer:

```shell
brew install fltk
```

You can [find instructions for installing](https://courses.cs.washington.edu/courses/csep557/14au/tools/fltk_install.html) the `fltk` library for other operating systems on the linked page. Add the project as a dependency to your `Cargo.toml` file:

```rust
[dependencies]
fltk = { version = "^1.3", features = ["fltk-bundled"] }
```

After adding the project and installing the `fltk` library, you can import the crate into your project:

```rust
use fltk::{app, button::Button, frame::Frame, prelude::*, window::Window};
```

Check out the [`fltk-rs` documentation](https://github.com/fltk-rs/fltk-rs) for a detailed overview of its functionalities and uses. 

The `fltk` library is quite popular and has more than 800 stars. It’s growing fast with more than 200 releases at this time and you can use the library in production without concerns. 

According to many other developers, using the `fltk-rs` library is more straightforward than the C++ library.

## The `iced` library <a name="iced-library">

[iced](https://iced.rs/) is a renderer-agnostic, batteries included, data-centered cross-platform Rust library for building GUIs and frontends, inspired by the Elm Architecture. [The `iced` library](https://github.com/iced-rs/iced) provides an easy-to-use, reactive programming model with first-class support for async actions and custom widgets. ![The Iced Library](https://blog.logrocket.com/wp-content/uploads/2022/08/iced-rs.jpeg) 

GUI applications built with the `iced` library can run on Windows, macOS, Linux, and the web (using the DOM) with a responsive layout. Conventionally, iced splits applications into four concepts:

*   State: for the state of the application
*   Messages: for messages and events
*   View logic: for displaying states as widgets for user interactions
*   Update logic: for updating state and interacting with messages

You can easily [get started using the Iced library for frontend web applications](https://blog.logrocket.com/iced-rs-tutorial-rust-frontend-web-app/). The process is similar to building GUI applications and you can check out [the iced documentation](https://github.com/iced-rs/iced/tree/master/examples) to learn more about the package. 

The `iced` library is one of the most popular Rust libraries due to its versatility. Although the library is used in many projects, it’s pretty unstable and has a rapid development. You can resort to using [older releases](https://github.com/iced-rs/iced/releases), as the master branch is constantly changing and might be expensive to use in production. 

You can find projects for inspiration, code examples, and library implementations in [this repository](https://github.com/iced-rs/iced/tree/master/examples).

## The `relm` library <a name="relm-library">

[relm](https://blog.logrocket.com/iced-rs-tutorial-rust-frontend-web-app/) is a GTK-based, asynchronous GUI library written initially in Rust. It’s inspired by the Elm Architecture to simplify GTK library usage and provide an Elm-like experience. 

Like the GTK library, you can build cross-platform GUIs using relm. ![The Relm Library](https://blog.logrocket.com/wp-content/uploads/2022/08/relm.jpeg) 

You’ll need to have experience using [the GTK library](https://gtk-rs.org/gtk4-rs/git/book/) to use relm and get the most out of the library. 

To use relm, you need to add the `gtk` and [`relm` libraries](https://github.com/antoyo/relm) to your project's dependencies in your `Cargo.toml` file. You’ll also need to have the `gtk` library installed.

```rust
[dependencies]
gtk = "0.9.0"
relm = "0.20.0"
relm-derive = "0.20.0"
```

You also have to import the `gtk` crate alongside the `relm` crates.

```rust
use relm::{connect, Relm, Update, Widget};
use gtk::prelude::*;
use gtk::{Window, Inhibit,a WindowType};
use relm_derive::Msg;
```

The Rust community appreciates relm for the Elm-like experience that other Rust libraries, like Yew, Seed, and iced, provide. The `relm` library is in its beta stage, hasn’t been appropriately tested, and is changing rapidly. With this said, you may not want to use it in production just yet.

## The Azul framework <a name="azul-framework">

[The Azul framework](https://github.com/fschutt/azul) is a reactive GUI library for building desktop GUIs in Rust, C, and C++. It’s powered by WebRender and is a document object model, similar to HTML and CSS. Since Azul leverages WebRender, it provides features like gradients, box shadows, border styling, and CSS transforms. 

![The Azul Framework](https://blog.logrocket.com/wp-content/uploads/2022/08/azul.jpeg) [The Azul framework](https://azul.rs/) also provides lots of inbuilt widgets, more than 60 frames per second animations, cross-platform native dialogues, SVG parsing, dynamic linking through the shared library, and HTML to Rust compilation for hot reloads. 

To get started using the Azul framework, add it to your project’s dependencies:

```rust
[dependencies]
azul = "1.0.0-alpha"
```

Then import the crates to your project and use them:

```rust
use azul::prelude::*;
use azul::widgets::{button::Button, label::Label};
```

The Azul framework is [well-documented](https://docs.rs/azul/latest/azul/) to help you get started building GUIs. 

The Azul framework takes a different approach to GUI development, and, so far, the framework has been used in more than 200 Rust projects. The Azul framework is functional, and, according to the documentation, you can use it in production.

## The `egui` library <a name="egui-library">

[The `egui` library](https://docs.rs/egui) is an immediate-mode, easy-to-use, portable library for building GUIs in Rust that run on the web, computers, and game engines (in development). It’s aiming to be the easiest library for building web applications in Rust. ![The Egui Library](https://blog.logrocket.com/wp-content/uploads/2022/08/egui.jpeg) 

The `egui` library aims to provide a safe, responsive, friendly, and portable experience for building GUIs with no callbacks and minimal dependencies. Check out [egui’s official documentation](https://docs.rs/egui/latest/egui/) to learn how you can use it to make cross-platform GUIs. 

The `egui` library is in active development, and, if you’re brave enough, you can use it in production. Specific parts of the `egui` library are ready and you can resort to older releases since newer ones are prone to breaking changes.

## Comparing Rust GUI libraries <a name="comparing-rust-gui-libraries">

The GUI libraries discussed in this article have different features and functionalities. Here’s a comparison table between the GUI libraries to help you make choices and considerations for your next project!

<table dir="ltr" border="1" cellspacing="0" cellpadding="0"><colgroup><col width="159"> <col width="232"> <col width="200"></colgroup>

<tbody>

<tr>

<td></td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Production Ready&quot;}">Production Ready</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Compatibility&quot;}">Compatibility</td>

</tr>

<tr>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;gtk-rs&quot;}">gtk-rs</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Yes&quot;}">Yes</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Cross-Platform&quot;}">Cross-Platform</td>

</tr>

<tr>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;fltk-rs&quot;}">fltk-rs</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Yes&quot;}">Yes</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Cross-Platform&quot;}">Cross-Platform</td>

</tr>

<tr>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;iced&quot;}">iced</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;No&quot;}">No</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Cross-Platform and Web&quot;}">Cross-Platform and Web</td>

</tr>

<tr>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;relm&quot;}">relm</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;No&quot;}">No</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Cross-Platform&quot;}">Cross-Platform</td>

</tr>

<tr>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Azul&quot;}">Azul</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Yes&quot;}">Yes</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Cross-Platform&quot;}">Cross-Platform</td>

</tr>

<tr>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;egui&quot;}">egui</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Older Releases&quot;}">Older Releases</td>

<td data-sheets-value="{&quot;1&quot;:2,&quot;2&quot;:&quot;Cross-Platform&quot;}">Cross-Platform</td>

</tr>

</tbody>

</table>

The GUI libraries in the Rust ecosystem are mostly premature projects with a lot of good features. 

For your projects, you’ll want to consider the state of the project for your application. It’s risky to use untested libraries or ones that aren't production-ready. You’ll also want to consider the project's compatibility based on what you’re building and where the project will or should run. 

As an example, the `iced` library is popular because it can run on Windows, Linux, macOS, and the web. It could be a good choice to use since your apps can share similarities and would be easier to maintain. The `gtk-rs` library is also lovely considering the library’s legacy. Additionally, you can use the `relm` library if you want to go the Elm way.

## Conclusion

There are many other GUI libraries in the Rust ecosystem, and you can find a comprehensive list on [Are We GUI Yet](http://areweguiyet.com/) and [LibHunt](https://www.libhunt.com/l/rust/topic/gui). 

This tutorial taught you about popular GUI libraries in the Rust ecosystem, including `gtk-rs` to `fltk-rs`, `iced`, `relm`, Azul, and `egui`. 

Hopefully, this tutorial has helped you with insights into choosing the GUI library for your next project!

---

## LogRocket: Full visibility into production Rust apps

Debugging Rust applications can be difficult, especially when users experience issues that are difficult to reproduce. If you’re interested in monitoring and tracking performance of your Rust apps, automatically surfacing errors, and tracking slow network requests and load time, [try LogRocket](https://logrocket.com/signup). 

[![LogRocket Dashboard Free Trial Banner](https://blog.logrocket.com/wp-content/uploads/2017/03/1d0cd-1s_rmyo6nbrasp-xtvbaxfg.png)](https://logrocket.com/signup)

[LogRocket](https://logrocket.com/signup) is like a DVR for web apps, recording literally everything that happens on your Rust app. Instead of guessing why problems happen, you can aggregate and report on what state your application was in when an issue occurred. LogRocket also monitors your app’s performance, reporting metrics like client CPU load, client memory usage, and more.

Modernize how you debug your Rust apps — [start monitoring for free](https://logrocket.com/signup).