Hex1b 0.99.0
See the version list below for details.
dotnet add package Hex1b --version 0.99.0
NuGet\Install-Package Hex1b -Version 0.99.0
<PackageReference Include="Hex1b" Version="0.99.0" />
<PackageVersion Include="Hex1b" Version="0.99.0" />
<PackageReference Include="Hex1b" />
paket add Hex1b --version 0.99.0
#r "nuget: Hex1b, 0.99.0"
#:package Hex1b@0.99.0
#addin nuget:?package=Hex1b&version=0.99.0
#tool nuget:?package=Hex1b&version=0.99.0
Hex1b
Hex1b is a .NET library for building TUI apps using an approachable code-first API.
Installation
dotnet add package Hex1b
Quick Start
Hello World
A minimal application that displays text and a quit button:
using Hex1b;
using var app = new Hex1bApp(ctx =>
ctx.VStack(b => [
b.Text("Hello, Terminal!"),
b.Button("Quit").OnClick(e => e.Context.RequestStop())
])
);
await app.RunAsync();
Counter with State
An interactive counter demonstrating mutable state across renders:
using Hex1b;
// State persists outside the builder function
var count = 0;
using var app = new Hex1bApp(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())
])
);
await app.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;
using var app = new Hex1bApp(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")
]).WithInputBindings(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");
})
);
await app.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 spaceSizeHint.Content– Size to fit contentSizeHint.Fixed(n)– Fixed size of n unitsSizeHint.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.WithInputBindings(bindings =>
{
// Simple key
bindings.Key(Hex1bKey.Delete).Action(() => DeleteItem());
// Modifier keys (Ctrl or Shift, but not both)
bindings.Ctrl().Key(Hex1bKey.S).Action(() => Save(), "Save");
bindings.Shift().Key(Hex1bKey.Tab).Action(() => FocusPrevious(), "Previous");
// 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;
using var app = new Hex1bApp(
builder,
new Hex1bAppOptions { Theme = Hex1bThemes.Sunset }
);
Documentation
License
Hex1b is licensed under the MIT License.
| Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- QRCoder (>= 1.7.0)
NuGet packages
This package is not used by any NuGet packages.
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.135.0 | 46 | 4/29/2026 |
| 0.134.0 | 101 | 4/24/2026 |
| 0.133.0 | 95 | 4/23/2026 |
| 0.132.0 | 102 | 4/22/2026 |
| 0.131.0 | 93 | 4/22/2026 |
| 0.130.0 | 170 | 4/17/2026 |
| 0.129.0 | 104 | 4/17/2026 |
| 0.128.0 | 309 | 4/11/2026 |
| 0.127.0 | 128 | 4/10/2026 |
| 0.126.0 | 111 | 4/9/2026 |
| 0.125.0 | 97 | 4/9/2026 |
| 0.124.0 | 404 | 3/30/2026 |
| 0.123.0 | 277 | 3/30/2026 |
| 0.122.0 | 1,441 | 3/19/2026 |
| 0.121.0 | 111 | 3/19/2026 |
| 0.120.0 | 165 | 3/19/2026 |
| 0.119.0 | 114 | 3/19/2026 |
| 0.118.0 | 923 | 3/14/2026 |
| 0.117.0 | 99 | 3/14/2026 |
| 0.99.0 | 201 | 2/26/2026 |
See https://github.com/hex1b/hex1b/releases for release notes.