Termina 0.7.0
See the version list below for details.
dotnet add package Termina --version 0.7.0
NuGet\Install-Package Termina -Version 0.7.0
<PackageReference Include="Termina" Version="0.7.0" />
<PackageVersion Include="Termina" Version="0.7.0" />
<PackageReference Include="Termina" />
paket add Termina --version 0.7.0
#r "nuget: Termina, 0.7.0"
#:package Termina@0.7.0
#addin nuget:?package=Termina&version=0.7.0
#tool nuget:?package=Termina&version=0.7.0
Termina
![]()
Termina is a reactive terminal UI (TUI) framework for .NET with declarative layouts and surgical region-based rendering. It provides an MVVM architecture with reactive properties, ASP.NET Core-style routing, and seamless integration with Microsoft.Extensions.Hosting.
Documentation
Features
- Reactive MVVM Architecture - ViewModels with
ReactiveProperty<T>for observable state management - Declarative Layouts - Tree-based layout system with size constraints (Fixed, Fill, Auto, Percent)
- Surgical Rendering - Only changed regions re-render, enabling smooth streaming updates
- ASP.NET Core-Style Routing - Route templates with parameters (
/tasks/{id:int}) and type constraints - Source Generators - AOT-compatible code generation for route parameters
- Streaming Support - Native
StreamingTextNodefor real-time content like LLM output - Dependency Injection - Full integration with
Microsoft.Extensions.DependencyInjection - Hosting Integration - Works with
Microsoft.Extensions.Hostingfor clean lifecycle management
Installation
dotnet add package Termina
dotnet add package Microsoft.Extensions.Hosting
Upgrading to 0.7.0? This release migrates from System.Reactive to R3 with breaking API changes. See the Migration Guide for details.
Quick Start
1. Define a ViewModel
using R3;
using Termina.Input;
using Termina.Reactive;
public class CounterViewModel : ReactiveViewModel
{
public ReactiveProperty<int> Count { get; } = new(0);
public ReactiveProperty<string> Message { get; } = new("Press Up/Down to change count");
public override void OnActivated()
{
Input.OfType<IInputEvent, KeyPressed>()
.Subscribe(HandleKey)
.DisposeWith(Subscriptions);
}
private void HandleKey(KeyPressed key)
{
switch (key.KeyInfo.Key)
{
case ConsoleKey.UpArrow:
Count.Value++;
Message.Value = $"Count: {Count.Value}";
break;
case ConsoleKey.DownArrow:
Count.Value--;
Message.Value = $"Count: {Count.Value}";
break;
case ConsoleKey.Escape:
Shutdown();
break;
}
}
public override void Dispose()
{
Count.Dispose();
Message.Dispose();
base.Dispose();
}
}
ReactiveProperty<T> is both a value holder and an Observable<T> — subscribe directly in your Page for reactive UI bindings.
2. Define a Page
using R3;
using Termina.Extensions;
using Termina.Layout;
using Termina.Reactive;
using Termina.Rendering;
using Termina.Terminal;
public class CounterPage : ReactivePage<CounterViewModel>
{
public override ILayoutNode BuildLayout()
{
return Layouts.Vertical()
.WithChild(
new PanelNode()
.WithTitle("Counter Demo")
.WithBorder(BorderStyle.Rounded)
.WithBorderColor(Color.Cyan)
.WithContent(
ViewModel.Count
.Select<int, ILayoutNode>(count => new TextNode($"Count: {count}")
.WithForeground(Color.BrightCyan))
.AsLayout())
.Height(5))
.WithChild(
ViewModel.Message
.Select<string, ILayoutNode>(msg => new TextNode(msg))
.AsLayout()
.Height(1));
}
}
3. Configure and Run
using Microsoft.Extensions.Hosting;
using Termina.Hosting;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddTermina("/counter", termina =>
{
termina.RegisterRoute<CounterPage, CounterViewModel>("/counter");
});
await builder.Build().RunAsync();
Layout System
Termina uses a declarative tree-based layout system:
Layouts.Vertical()
.WithChild(header.Height(3)) // Fixed height
.WithChild(content.Fill()) // Take remaining space
.WithChild(sidebar.Width(20)) // Fixed width
.WithChild(footer.Height(1)); // Fixed height
Layouts.Horizontal()
.WithChild(menu.Width(30))
.WithChild(main.Fill(2)) // 2x weight
.WithChild(aside.Fill(1)); // 1x weight
Routing
ASP.NET Core-style route templates with parameter support:
builder.Services.AddTermina("/", termina =>
{
termina.RegisterRoute<HomePage, HomeViewModel>("/");
termina.RegisterRoute<TasksPage, TasksViewModel>("/tasks");
termina.RegisterRoute<TaskDetailPage, TaskDetailViewModel>("/tasks/{id:int}");
termina.RegisterRoute<UserPage, UserViewModel>("/users/{name}");
});
Route Parameter Injection
public partial class TaskDetailViewModel : ReactiveViewModel
{
[FromRoute] private int _id; // Injected from route
public override void OnActivated()
{
LoadTask(Id); // Id is already populated
}
}
Navigation
Navigate("/tasks/42");
NavigateWithParams("/tasks/{id}", new { id = 42 });
Shutdown(); // Exit the application
Streaming Content
For real-time content like LLM output, Pages own StreamingTextNode and subscribe to ViewModel observables:
// In Page
private StreamingTextNode _output = null!;
protected override void OnBound()
{
_output = StreamingTextNode.Create();
ViewModel.StreamOutput.Subscribe(chunk => _output.Append(chunk));
}
// In ViewModel
public Observable<string> StreamOutput => _streamOutput;
private readonly Subject<string> _streamOutput = new();
private async Task StreamResponse()
{
await foreach (var chunk in GetStreamingData())
{
_streamOutput.OnNext(chunk); // Character-level updates
}
}
Testing
VirtualInputSource enables automated testing:
var scriptedInput = new VirtualInputSource();
builder.Services.AddTerminaVirtualInput(scriptedInput);
scriptedInput.EnqueueKey(ConsoleKey.UpArrow);
scriptedInput.EnqueueString("Hello World");
scriptedInput.EnqueueKey(ConsoleKey.Enter);
scriptedInput.Complete();
await host.RunAsync();
Requirements
- .NET 10.0 or later
- AOT-compatible (Native AOT publishing supported)
License
Apache 2.0 - See LICENSE for details.
Contributing
Contributions are welcome! See CONTRIBUTING.md for development setup and guidelines.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.3)
- R3 (>= 1.3.0)
- Termina.Generators (>= 0.7.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.2 | 427 | 3/1/2026 |
| 0.7.1 | 344 | 2/27/2026 |
| 0.7.0 | 42 | 2/26/2026 |
| 0.6.1 | 42 | 2/25/2026 |
| 0.6.0 | 240 | 2/24/2026 |
| 0.5.1 | 413 | 12/19/2025 |
| 0.5.0 | 259 | 12/18/2025 |
| 0.4.0 | 300 | 12/18/2025 |
| 0.3.0 | 239 | 12/17/2025 |
| 0.2.1 | 677 | 12/16/2025 |
| 0.2.0 | 246 | 12/16/2025 |
| 0.1.0 | 265 | 12/16/2025 |
| 0.1.0-beta1 | 72 | 12/12/2025 |
**Breaking Changes**:
- **Migrate from System.Reactive to R3** ([#140](https://github.com/Aaronontheweb/Termina/pull/140))
- Replaced System.Reactive (Rx.NET) with [R3](https://github.com/Cysharp/R3) throughout the framework
- `IObservable<T>` → `Observable<T>` in all public APIs
- `OfType<T>()` → `OfType<TSrc, TDest>()` (R3 requires both type parameters)
- `Select(...)` may require explicit type parameters: `Select<TIn, TOut>(...)`
- `Subscribe` callbacks: `onError` → `onErrorResume`, `onCompleted` takes `Result` parameter
- `BehaviorSubject<T>` removed — use `ReactiveProperty<T>` instead
- `Subject<T>` now from R3 namespace
- See [Migration Guide](https://aaronstannard.com/termina/guide/migration-0.7.html) for details
- **Replace `[Reactive]` source generator with `ReactiveProperty<T>`** ([#149](https://github.com/Aaronontheweb/Termina/pull/149))
- Removed `[Reactive]` attribute and its source generator
- Use `ReactiveProperty<T>` for all ViewModel state: `public ReactiveProperty<int> Count { get; } = new(0);`
- Property access via `.Value`: `Count.Value++` instead of `Count++`
- Page bindings subscribe directly to property: `ViewModel.Count.Select(...)` instead of `ViewModel.CountChanged.Select(...)`
- ViewModels no longer need `partial` keyword (unless using `[FromRoute]`)
- Manual `Dispose()` override required to dispose all `ReactiveProperty<T>` instances
- Built-in `DistinctUntilChanged` — only emits when value actually changes
- **Replace timers with `Observable.Interval` + `TimeProvider`** ([#140](https://github.com/Aaronontheweb/Termina/pull/140))
- All timer-based components now accept optional `TimeProvider` parameter
- Enables deterministic testing with `FakeTimeProvider`
- `System.Timers.Timer` and `System.Threading.Timer` no longer used
**New Features**:
- **DynamicLayoutNode** ([#147](https://github.com/Aaronontheweb/Termina/issues/147))
- New `Layouts.Dynamic(Func<ILayoutNode> factory)` for imperative, page-local state
- Re-evaluates factory on each Render/Measure cycle with reference equality to avoid lifecycle churn
- `Invalidate()` method for programmatic trigger; `AsDynamicLayout(Observable<Unit>)` extension
- Implements `IInvalidatingNode` for proper invalidation propagation
- **FocusManager auto-focus and Tab cycling** ([#146](https://github.com/Aaronontheweb/Termina/issues/146))
- `FocusPolicy` enum: `Manual`, `FirstFocusable`, `ByPriority` — set on `ReactivePage` for automatic focus on navigation
- `CollectFocusables(ILayoutNode root)` — depth-first tree walk collecting focusable nodes
- `CycleFocus(focusables, reverse)` — next/previous with wrap-around
- `CycleFocusForward()` / `CycleFocusBackward()` helpers on `ReactivePage`
- `FocusManager` migrated from `BehaviorSubject<IFocusable?>` to `ReactiveProperty<IFocusable?>`
- **WizardNode** ([#148](https://github.com/Aaronontheweb/Termina/issues/148))
- Multi-step wizard component: `Layouts.Wizard<TStep>()` where `TStep : struct, Enum`
- Fluent builder: `.WithStep()`, `.WithProgressStyle()`, `.WithTitle()`, `.WithBorder()`
- Navigation: `TryAdvance()`, `TryGoBack()`, `GoToStep()`, `AdvanceSubStep()`
- Cancellable `BeforeAdvance` observable for step validation
- `StepChanged` and `Completed` observables
- Progress styles: `BlockBar`, `Arrow`, `Dots`, `None`
- Sub-step support within each step
- Implements `IFocusable` and `IInvalidatingNode`
- Uses `DynamicLayoutNode` internally for step content switching
**Bug Fixes**:
- **Fix invalidation subscription lost after navigation round-trip** ([#150](https://github.com/Aaronontheweb/Termina/pull/150))
- Fixed rendering bug where leaf nodes lost their invalidation subscriptions after navigating away and back
- Custom `LayoutNode` subclasses should use `CreateSubContext(bounds)` in Render methods
**Cleanup**:
- Removed dead `HasReactiveAttribute` helper from `LayoutNodeInViewModelAnalyzer` (references removed `[Reactive]` attribute)
---