ZigZag - A TUI framework for Zig

Hey everyone! I just released v0.1.0 of ZigZag, a TUI framework inspired by Go’s Bubble Tea and Lipgloss.

I built this because I wanted a nice way to build terminal UIs in Zig without reaching for C libraries or bindings.

Features:

  • Elm-inspired architecture (Model-View-Update)

  • Flexbox-like layouts

  • Styling (colors, borders, padding, etc.)

  • Input handling

Repo: https://github.com/meszmate/zigzag

Still early days, feedback and contributions welcome!

39 Likes

Are you going to update the project or its just as it is right now? Update I mean by updating to the newest zig 0.16.0 in the future.

Yep, actively maintained! I’ll keep it updated with new Zig releases.

3 Likes

Elm thinking is great

1 Like

This is really cool! I’ve been on the lookout for something like this.

1 Like

Awesome project, I look forward to using it.

1 Like

How lovely is this! Impressed.

2 Likes

First patch release! Mostly focused on fixes and laying groundwork.

What’s new:

  • Custom event loop support: you can now bring your own event loop instead of relying on the built-in one

  • Unicode support (+ a unicode tab in the showcase to play with)

Fixes:

  • Windows compilation is working now

  • Terminal state properly restores on exit (no more messed up terminals)

5 Likes

I’ve been looking though the code, has AI been used in this project?

Yeah, used AI for parts of it.

1 Like

Hey! I’ve been using bubbletea a lot, and the similarity makes me wonder if you started this project by asking a LLM to translate bubbletea to zig. Is it the case ? If so, did you test extensively the resulting code ?

Bubbletea was a big inspiration for the architecture, yeah. I used LLMs as a tool during development like I do with most projects nowadays, but it’s not a translation. Zig requires a very different approach to memory management, error handling, etc. And yes, everything is tested and properly maintained.

8 Likes

ZigZag v0.1.2 released: chart components, inline image support, overlays, focus management, and Windows fixes

zigzag v0.1.2 has been released.

This update adds a few larger pieces to the UI layer: charting support, canvas drawing, inline terminal images, focus management, modal/tooltip overlays, tab groups, and OSC 52 clipboard support. It also includes a number of fixes around text input, layout, cursor rendering, frame timing, and Windows event handling.

Included in v0.1.2:

  • Added parentheses around struct literals. (#10)

  • Fixed a memory leak in the todo_list example. (#14)

  • Fixed the layout issue in example showcase tab five. (#15)

  • Fixed Chinese input handling in TextArea and TextInput. (#16)

  • Fixed text editor cursor display. (#18)

  • Fixed the Windows readInput blocking call that disabled ticking. (#22)

  • Added soft word wrap to TextArea. (#23)

  • Fixed a nil pointer dereference when using ctx.allocator in init. (#26)

  • Drained non-byte console events to unblock the initial tick on Windows. (#27)

  • Fixed missing placeholder padding and empty row padding in TextArea. (#30)

  • Fixed an extra newline in inline styles. (#31)

  • Fixed frame timings and non-monotonic clock issues. (#34)

  • Added inline image support for Kitty, iTerm2, and Sixel. (#35)

  • Extended image support with caching, in-memory data, z-index, and protocol selection. (#36)

  • Added a focus management system with customizable key bindings. (#37)

  • Added Modal and Tooltip overlay components. (#38)

  • Added TabGroup for multi-screen tab navigation. (#39)

  • Added OSC 52 clipboard support for copy and query. (#40)

  • Added Chart, BarChart, and Canvas components, and enhanced Viewport. (#41)

  • Improved responsive chart layout. (#42)

Contributors in this release: nwindian, dacec354 and me

8 Likes

Hey folks,

Just shipped v0.1.3 of ZigZag, my Elm-architecture TUI framework for Zig (inspired by Bubble Tea / Lipgloss). This release got pretty big, here’s what’s new since v0.1.2:

18 new components

  • Input/forms: Form, Dropdown, Checkbox/RadioGroup, Slider, MenuBar, ContextMenu

  • Data: SortableTable (column sort + filter), DataTable (cell-cursor, frozen columns), VirtualList (lazy rendering for 100K+ items)

  • Visualization: Gauge, Heatmap, Calendar/DatePicker, BrailleCanvas (pixel-grid drawing)

  • Content: Markdown renderer, CodeView (syntax highlighting), DiffView (unified + side-by-side), RichLog (append-only log panes)

New systems

  • Theming with built-in palettes + ThemeManager

  • Animation system (easing + tweens)

  • Constraint-based Flexbox layout engine

  • Layer compositing with z-ordering

  • SubProgram for nested Model-Update-View composition

  • AsyncRunner for background tasks

  • ScreenStack router for push/pop navigation

  • Accessibility module (WCAG contrast + roles)

  • WASM platform backend — you can target the browser now

  • DevConsole log streamer (file/tcp/stderr sinks)

  • Mouse hit-testing utilities

  • Text overflow policies (hidden, ellipsis, word_wrap, char_wrap)

Fixes & polish

  • Memory leaks in file_browser, modal, toast

  • word_wrap crash from unsigned integer underflow

  • Form submit on Ctrl+S works across terminals

  • Full customizability for every component

  • Writergate compatibility (thanks Cohors1316!)

Pinned to Zig 0.15.2. Zero deps, pure Zig.

Release notes: https://github.com/meszmate/zigzag/releases/tag/v0.1.3

Feedback welcome, especially curious what people want to see next.

5 Likes

Do you intend to move to 0.16.x? I expect it’s quite a bit of work, no?

Yep, working on it. Want to get it right rather than rush, so probably the next release.

4 Likes