Skip to content

meszmate/zigzag

Repository files navigation

ZigZag

A TUI framework for Zig.

CI status Latest release MIT license Zig 0.16.0

Features · How it works · Quick start · Components · Examples · Reference

ZigZag component showcase

ZigZag brings typed Model-Update-View applications, rich styling, flexible layout, and 40+ components to the terminal with no third-party dependencies.

Features

Capability Highlights
Architecture Typed Model-Update-View, commands, async tasks, sub-programs
Components 40+ inputs, tables, lists, charts, forms, and overlays
Styling ANSI, 256-color, TrueColor, adaptive themes, borders, and text overflow
Layout Placement, Flexbox constraints, split panes, and layered composition
Terminal support Keyboard, mouse, clipboard, images, suspend/resume
Performance Diff rendering, ANSI compression, and virtual lists

How it works

Events update the model, then view renders the next terminal frame.

flowchart LR
  E["Input · timer · async"] --> U["update"]
  U --> M["Model"]
  M --> V["view"]
  V --> T["Terminal"]
  U --> C["Command"]
  C --> E
Loading

Quick start

Requires Zig 0.16.0 or newer.

zig fetch --save git+https://github.com/meszmate/zigzag#main
const zigzag = b.dependency("zigzag", .{
    .target = target,
    .optimize = optimize,
});

exe.root_module.addImport("zigzag", zigzag.module("zigzag"));

Start with the counter example.

Components

Category Includes
Input and forms Text input, text area, checkbox, radio group, slider, dropdown, form, file picker, stepper
Data and navigation List, virtual list, table, sortable table, data table, tree, tabs, breadcrumbs, screen stacks
Visualization Progress, spinner, gauge, sparkline, chart, bar chart, heatmap, canvas, Braille canvas
Overlays and feedback Modal, confirmation, tooltip, notification, toast, context menu, command palette
Content and tooling Markdown, code view, diff view, rich log, status bar, help, developer console

Browse the component index →

Examples

Demo Run
Showcase zig build run-showcase
Dashboard zig build run-dashboard
File browser zig build run-file_browser
WebAssembly zig build run-wasm_app

See every example →

Documentation

Reference · Examples · Contributing

Projects using ZigZag

  • zmenu, a simple Zig application launcher for GNU/Linux

Star ZigZag ⭐

If ZigZag helps you build a terminal application, consider starring the repository. Stars help other Zig developers discover the project, show that the framework is useful, and motivate continued work on components, terminal support, and documentation.

License

MIT

Releases

Contributors

Languages