Hex1b 0.176.0

dotnet add package Hex1b --version 0.176.0
                    
NuGet\Install-Package Hex1b -Version 0.176.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hex1b" Version="0.176.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hex1b" Version="0.176.0" />
                    
Directory.Packages.props
<PackageReference Include="Hex1b" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hex1b --version 0.176.0
                    
#r "nuget: Hex1b, 0.176.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hex1b@0.176.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hex1b&version=0.176.0
                    
Install as a Cake Addin
#tool nuget:?package=Hex1b&version=0.176.0
                    
Install as a Cake Tool

Hex1b

Hex1b is a .NET library for building TUI apps using an approachable code-first API.

NuGet License: MIT

Installation

dotnet add package Hex1b

Quick Start

Hello World

A minimal application that displays text and a quit button:

using Hex1b;

await using var terminal = Hex1bTerminal.CreateBuilder().WithHex1bApp(ctx =>
    ctx.VStack(b => [
        b.Text("Hello, Terminal!"),
        b.Button("Quit").OnClick(e => e.Context.RequestStop())
    ])
).Build();

await terminal.RunAsync();

Counter with State

An interactive counter demonstrating mutable state across renders:

using Hex1b;

// State persists outside the builder function
var count = 0;

await using var terminal = Hex1bTerminal.CreateBuilder().WithHex1bApp(ctx =>
    ctx.VStack(b => [
        b.Text($"Count: {count}"),
        b.Button("Increment").OnClick(_ => count++),
        b.Button("Decrement").OnClick(_ => count--),
        b.Text(""),
        b.Button("Quit").OnClick(e => e.Context.RequestStop())
    ])
).Build();

await terminal.RunAsync();

Counter with Custom Key Bindings

A counter controlled with custom keyboard shortcuts (Ctrl+A to increment, Ctrl+D to decrement):

using Hex1b;
using Hex1b.Input;

var count = 0;

await using var terminal = Hex1bTerminal.CreateBuilder().WithHex1bApp(ctx =>
    ctx.VStack(b => [
        b.Text($"Count: {count}"),
        b.Text(""),
        b.Text("Ctrl+A: Increment"),
        b.Text("Ctrl+D: Decrement"),
        b.Text("Ctrl+Q: Quit")
    ]).InputBindings(bindings =>
    {
        bindings.Ctrl().Key(Hex1bKey.A).Action(() => count++, "Increment counter");
        bindings.Ctrl().Key(Hex1bKey.D).Action(() => count--, "Decrement counter");
        bindings.Ctrl().Key(Hex1bKey.Q).Action(ctx => ctx.RequestStop(), "Quit");
    })
).Build();

await terminal.RunAsync();

Layout System

Hex1b uses a constraint-based layout system with size hints:

// Vertical stack with flexible sizing
new VStackWidget(
    children: [contentWidget, statusBarWidget],
    sizeHints: [SizeHint.Fill, SizeHint.Content]
);

Size Hints:

  • SizeHint.Fill – Expand to fill available space
  • SizeHint.Content – Size to fit content
  • SizeHint.Fixed(n) – Fixed size of n units
  • SizeHint.Weighted(n) – Proportional sizing with weight n

Widgets

Widget Description
TextBlockWidget Display static or dynamic text
TextBoxWidget Editable text input with cursor and selection
ButtonWidget Clickable button with label and action
ListWidget Scrollable list with selection support
VStackWidget Vertical layout container
HStackWidget Horizontal layout container
SplitterWidget Resizable split pane layout
BorderWidget Container with border and optional title
ScrollPanelWidget Scrollable content area

Input Bindings

Define keyboard shortcuts using the fluent builder API:

widget.InputBindings(bindings =>
{
    // Simple key
    bindings.Key(Hex1bKey.Delete).Action(() => DeleteItem());
    
    // Modifier keys (any combination)
    bindings.Ctrl().Key(Hex1bKey.S).Action(() => Save(), "Save");
    bindings.Shift().Key(Hex1bKey.Tab).Action(() => FocusPrevious(), "Previous");
    bindings.Ctrl().Shift().Key(Hex1bKey.S).Action(() => SaveAs(), "Save as");
    
    // Multi-step chords
    bindings.Ctrl().Key(Hex1bKey.K)
        .Then().Key(Hex1bKey.C)
        .Action(() => CommentLine(), "Comment line");
});

Theming

Apply built-in themes or create your own:

using Hex1b.Theming;

await using var terminal = Hex1bTerminal.CreateBuilder()
    .WithHex1bApp(options => options.Theme = Hex1bThemes.Sunset, builder)
    .Build();
await terminal.RunAsync();

Construction and Native AOT

Construct applications through Hex1bTerminal; Hex1bApp constructors are internal. The terminal owns the app lifetime. Use the WithHex1bApp options callback for app configuration and its app-instance callback when you need Invalidate() or RequestStop() outside widget event handlers.

CreateBuilder() keeps the normal interactive console defaults. CreateSlimBuilder() registers neither presentation nor workload; explicitly configure both. For headless Native AOT applications:

await using var terminal = Hex1bTerminal.CreateSlimBuilder()
    .WithHeadless()
    .WithHex1bApp(ctx => ctx.Text("Hello"))
    .Build();
await terminal.RunAsync();

Calling WithHeadless() on the normal builder replaces its presentation at runtime but can retain console code in a Native AOT binary. The slim entry point avoids registering that console factory in the first place.

Documentation

License

Hex1b is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (87)

Showing the top 5 NuGet packages that depend on Hex1b:

Package Downloads
Aspire.Hosting

Core abstractions for the Aspire application model.

Aspire.Hosting.AppHost

Core library and MSBuild logic for Aspire AppHost projects.

Aspire.Hosting.Azure

Azure resource types for Aspire.

Aspire.Hosting.PostgreSQL

PostgreSQL® support for Aspire.

Aspire.Hosting.Testing

Testing support for the Aspire application model.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Hex1b:

Repository Stars
microsoft/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
Version Downloads Last Updated
0.176.0 73 11/11/2026
0.176.0-beta.2071.1.1976946 53 11/9/2026
0.175.0 4,956 10/15/2026
0.175.0-alpha.1963.1.e84f086 510 10/14/2026
0.175.0-alpha.1905.1.34394d2 105 10/13/2026
0.175.0-alpha.1898.1.9dc034e 112 10/11/2026
0.174.0 3,742 10/11/2026
0.174.0-beta.1899.1.9dc034e 110 10/11/2026
0.174.0-alpha.1835.1.1856406 108 10/11/2026
0.173.0 245,652 10/8/2026
0.173.0-alpha.1824.1.98d8766 620 10/4/2026
0.173.0-alpha.1801.1.3dc2d9b 116 10/4/2026
0.172.0 79,332 9/27/2026
0.172.0-beta.1788.1.f01b043 140 9/27/2026
0.172.0-alpha.1787.1.f01b043 1,261 9/26/2026
0.172.0-alpha.1785.1.d253961 498 9/25/2026
0.172.0-alpha.1654.1.f826137 496 9/25/2026
0.172.0-alpha.1652.1.6a01c54 119 9/22/2026
0.172.0-alpha.1650.1.2df4512 125 9/22/2026
0.171.0 16,887 9/22/2026
Loading failed