Skip to content

Terminal User Interfaces

Build rich, interactive terminal user interfaces with Hex1b's React-inspired declarative API. Create dashboards, developer tools, configuration wizards, and CLI experiences that go far beyond simple text output.

Why Hex1b for TUIs?

Traditional terminal UI libraries require you to manage low-level screen updates, cursor positioning, and state synchronization manually. Hex1b takes a different approach:

  • Declarative API — Describe what you want to render, not how to render it
  • Automatic diffing — Only screen regions that change get updated
  • Constraint-based layout — Flexible layouts that adapt to terminal size
  • Rich widget library — Buttons, text boxes, lists, progress bars, and more
  • Theming system — Consistent styling across your entire application

The Basics

You provide a builder function that returns widgets. Hex1b handles the rest:

csharp
await using var terminal = Hex1bTerminal.CreateBuilder()
    .WithHex1bApp((app, options) => ctx =>
        ctx.Border(b => [
            b.Text("Hello from Hex1b!"),
            b.Button("Click me").OnClick(_ => Console.Beep())
        ], title: "My App"))
    .Build();

await terminal.RunAsync();

Building TUIs

  1. Your First App — Install Hex1b and create your first app
  2. Widgets & Nodes — Understand the architecture
  3. Layout System — Master constraint-based layouts
  4. Input Handling — Keyboard navigation and shortcuts
  5. Theming — Customize appearance

Reference

  • Widgets — Explore the full widget library
  • Testing — Test your TUI applications

Released under the MIT License.