created_at2024-04-08 05:14:05.040126
updated_at2024-06-04 18:02:38.843943
descriptionCross-platform GUI framework.
owners (github:zng-ui:owners)




Zng is a cross-platform GUI framework, it provides ready made highly customizable widgets, responsive layout, live data binding, easy localization, automatic focus navigation and accessibility, async and multi-threaded tasks, robust multi-process architecture and more.

Zng is pronounced "zing", or as an initialism: ZNG (Z Nesting Graphics).


First add zng to your Cargo.toml, or call cargo add zng -F view_prebuilt:

zng = { version = "0.7.0", features = ["view_prebuilt"] }

Then create your first window:

use zng::prelude::*;

fn main() {
    APP.defaults().run_window(async {
        let size = var(layout::Size::new(800, 600));
        Window! {
            title = size.map(|s| formatx!("Button Example - {s}"));
            child_align = Align::CENTER;
            child = Button! {
                on_click = hn!(|_| {
                    println!("Button clicked!");
                text::font_size = 28;
                child = Text!("Click Me!");

See the documentation for more details.

Cargo Features

This crate provides 29 feature flags, 4 enabled by default.


Include the default view-process implementation.


Include the default view-process implementation as an embedded precompiled binary.


Enables HTTP tasks and web features of widgets and services.


Enable the "dyn_*", "inspector" features in debug builds.

Enabled by default.


Use more dynamic dispatch at the node level by enabling UiNode::cfg_boxed to box.

This speeds-up compilation time at the cost of runtime.


Instrument each property and widget instance with "Inspector" nodes and extend windows to be inspected on Ctrl+Shift+I.


Enable hot reload builds.

Note that you must configure the target library to hot reload, see zng::hot_reload for details.


Use dynamic dispatch at the app-extension level.

This speeds-up compilation time at the cost of runtime.


Box closures at opportune places, such as Var::map, reducing the number of monomorphised types.

This speeds-up compilation time at the cost of runtime.


Test utilities.


Allows multiple app instances per-process.

This feature allows multiple apps, one app per thread at a time. The LocalContext tracks what app is currently running in each thread and app_local! statics switch to the value of each app depending on the current thread.

Not enabled by default, but enabled by feature="test_util".


Enables single app-process instance mode.

Builds with this feature only allow one app-process, subsequent attempts to spawn the app redirect to the running app-process.


Allow app-process crash handler.

Builds with this feature spawn a crash monitor-process for each app-process.

Enabled by default.


Instrument every widget outer-most node to trace UI methods.


Instrument every property and intrinsic node to trace UI methods.

Note that this can cause very large trace files and bad performance.


Spawns a thread on app creation that checks and prints parking_lot deadlocks.


Embed hyphenation dictionaries for all supported languages.

If enabled some 2.8MB of data is embedded, you can provide an alternative dictionary source using the HYPHENATION::init_data_source method.


Include all Material Icons icon sets in the default app.


Material Icons Outlined icon set.

If enabled some icons of this set are used for some of the commands.


Material Icons Filled icon set.


Material Icons Rounded icon set.


Material Icons Sharp icon set.


Enable TOML configs.


Enable RON configs.


Enable YAML configs.


Enables software renderer fallback in the default view-process.

If enabled and a native OpenGL 3.2 driver is not available the swgl software renderer is used.

Enabled by default.


Collects and bundles third-party licenses used by the zng-view crate.

Needs cargo-about and Internet connection during build.

Not enabled by default. Note that "view_prebuilt" always bundles licenses.


Enables IPC tasks, pre-build views and connecting to views running in another process.

Enabled by default.


Check if zng::env::res path is available in init_built_res first.

Enabled by default in debug builds.


See the zng-ui/zng repository README for more information about build requirements, examples and license information.

Commit count: 7931

cargo fmt