No description
Find a file
2025-12-18 10:26:54 +01:00
example Add configurable buffer size to example 2025-12-04 09:16:06 +01:00
src Add configurable buffer size to example 2025-12-04 09:16:06 +01:00
.envrc batman 2025-11-25 09:42:01 +01:00
.gitignore batman 2025-11-25 09:42:01 +01:00
build.zig Add configurable buffer size to example 2025-12-04 09:16:06 +01:00
build.zig.zon batman 2025-11-25 09:42:01 +01:00
flake.lock batman 2025-11-25 09:42:01 +01:00
flake.nix batman 2025-11-25 09:42:01 +01:00
README.md Add brainmade bagde 2025-12-18 10:26:54 +01:00

libtui - simple, low-level TUI library

brainmade.org

This is a library to make TUI applications. It is targeted mainly at building with a very low-level API, only abstracting all the different tty and terminal quirks, not providing a whole TUI Toolkit to build fancy UIs. That way, this library stays simple and small, understandable and easy to use.

Status

This project is very very alpha, do not use in production or for anything meaningful. The API will probably change quite a bit without any versioning at first. If you are still interested, i would be happy to hear about projects and ideas to improve this library.

Installation

zig fetch --save git+https://git.nkoll.de/nk/libtui.git
// build.zig
pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    // get the dependecy
    const libtui = b.dependency("libtui", .{
        .target = target,
        .optimize = optimize,
    });

    const exe = b.addExecutable(.{
        .name = "example",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
            .imports = &.{
                // add libtui as an import
                .{ .name = "libtui", .module = libtui.module("libtui") },
            },
        }),
    });

    b.installArtifact(exe);
}

Usage

For a comprehensive example, look at example/main.zig, which shows how to read and write to the TUI, how to set it up, how to register the resize listener etc.