Skip to content

Installation & Build Setup ​

tui.zig requires Zig 0.17.0+ (zig version). No system C libraries or external native toolchains are required.

Pin the v0.1.0 tagged release archive for reproducible builds:

sh
zig fetch --save https://github.com/muhammad-fiaz/tui.zig/archive/refs/tags/0.1.0.tar.gz

Method 2: Main Branch Install ​

Track the latest commits on the main branch:

sh
zig fetch --save git+https://github.com/muhammad-fiaz/tui.zig.git#main

Or declare either dependency explicitly inside build.zig.zon:

zig
.dependencies = .{
    .tui = .{
        .url = "https://github.com/muhammad-fiaz/tui.zig/archive/refs/tags/0.1.0.tar.gz",
        .hash = "...", // Generated by `zig fetch --save`
    },
},

3. Wire Module in build.zig ​

zig
const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const tui_dep = b.dependency("tui", .{
        .target = target,
        .optimize = optimize,
    });

    const exe = b.addExecutable(.{
        .name = "my-tui-app",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{
                .{ .name = "tui", .module = tui_dep.module("tui") },
            },
        }),
    });

    b.installArtifact(exe);
}

4. Repository Build Targets ​

Inside the tui.zig repository itself:

CommandPurpose
zig buildBuild the static library archive
zig build testRun all library and widget unit/integration tests
zig build examplesCompile all 34 example binaries
zig build run-all-examplesExecute every example in non-interactive --headless mode
zig build run-<name>Run any specific interactive example (e.g. zig build run-custom-ui)
zig build docsEmit Zig HTML API documentation into zig-out/docs/
zig build -Dtarget=x86_64-linux-gnuCross-compile for 64-bit Linux
zig build -Dtarget=x86-windowsCross-compile for 32-bit Windows
zig build -Dtarget=aarch64-macosCross-compile for Apple Silicon macOS

Released under the MIT License.