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. ```mermaid flowchart LR E["Input · timer · async"] --> U["update"] U --> M["Model"] M --> V["view"] V --> T["Terminal"] U --> C["Command"] C --> E ``` ## Quick start Requires Zig 0.16.0 or newer. ```sh zig fetch --save git+https://github.com/meszmate/zigzag#main ``` ```zig const zigzag = b.dependency("zigzag", .{ .target = target, .optimize = optimize, }); exe.root_module.addImport("zigzag", zigzag.module("zigzag")); ``` Start with the [counter example](examples/counter.zig). ## 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 →](REFERENCE.md#components) ## Examples | Demo | Run | |------|-----| | [Showcase](examples/showcase.zig) | `zig build run-showcase` | | [Dashboard](examples/dashboard.zig) | `zig build run-dashboard` | | [File browser](examples/file_browser.zig) | `zig build run-file_browser` | | [WebAssembly](examples/wasm_app.zig) | `zig build run-wasm_app` | [See every example →](examples/) ## Documentation [Reference](REFERENCE.md) · [Examples](examples/) · [Contributing](CONTRIBUTING.md) ## Projects using ZigZag - [zmenu](https://github.com/menosbits/zmenu), a simple Zig application launcher for GNU/Linux ## Star ZigZag ⭐ If ZigZag helps you build a terminal application, consider [starring the repository](https://github.com/meszmate/zigzag). 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](LICENSE)