ktsu.TUI.Core 1.0.6

ktsu.TUI

A modern, extensible Text User Interface (TUI) library for .NET applications built on top of Spectre.Console. This library provides a clean, object-oriented approach to building interactive terminal applications with rich visual features.

Overview

ktsu.TUI is designed with SOLID principles and provides a modular architecture for creating terminal-based user interfaces. It features:

  • Modular Architecture: Clean separation of concerns with contracts, models, services, and UI elements
  • Event-Driven Rendering: Efficient rendering system that only updates when needed
  • Extensible Design: Easy to extend with custom UI elements and layouts
  • Provider Abstraction: Pluggable console providers (currently supports Spectre.Console)
  • Dependency Injection Ready: Built with DI in mind for easy integration

Features

Rich Text Styling: Bold, italic, underline, colors, and background colors
Border Elements: Multiple border styles (single, double, rounded, thick, ASCII, none)
Layout System: Stack panels with horizontal/vertical orientation and spacing
Input Handling: Keyboard input processing with ESC to exit
Alignment Support: Horizontal and vertical text alignment
Padding & Positioning: Flexible positioning and padding system
Responsive Design: Automatic sizing based on content and container dimensions

Architecture

Contracts → Models → Services
    ↓         ↓         ↓
Elements → Layouts → Primitives
    ↓
Provider Abstraction
  • Contracts: Interfaces defining the core abstractions
  • Models: Data structures for styling, positioning, and input
  • Services: Core application logic and console providers
  • Elements: UI components (primitives like borders/text, layouts like stack panels)
  • Extensions: Helper methods and utilities

Installation

Add the NuGet package:

dotnet add package ktsu.TUI

Quick Start

using ktsu.TUI.Core.Services;
using ktsu.TUI.Core.Elements.Primitives;
using ktsu.TUI.Core.Elements.Layouts;
using ktsu.TUI.Core.Models;

// Create console provider
var consoleProvider = new SpectreConsoleProvider();

// Create a simple UI
var ui = new BorderElement
{
    Title = "My TUI App",
    BorderStyle = BorderStyle.Double,
    Child = new TextElement
    {
        Text = "Hello, TUI World!",
        Style = new TextStyle { IsBold = true, Foreground = "green" }
    }
};

// Create and run application
var app = UIApplication.CreateBuilder(consoleProvider)
    .UseRootElement(ui)
    .Build();

await app.RunAsync();

Demo Applications

The library includes several demonstration applications:

  • Sample App (default): Advanced demo showcasing architecture and features
  • Interactive Demo: Interactive controls and real-time updates (--interactive)
  • Showcase Demo: Visual demonstration of all styling features (--showcase)

Run demos:

dotnet run --project TUI.App                    # Sample app
dotnet run --project TUI.App -- --interactive   # Interactive demo
dotnet run --project TUI.App -- --showcase      # Showcase demo

Key Components

UI Elements

  • TextElement: Styled text display
  • BorderElement: Bordered containers with titles
  • StackPanel: Horizontal/vertical layout container

Styling

  • TextStyle: Font styling (bold, italic, underline, colors)
  • BorderStyle: Border appearance (single, double, rounded, etc.)
  • Padding: Space around content
  • Position: Element positioning

Input System

  • Keyboard input handling
  • ESC key to exit applications
  • Extensible input event system

Contributing

This project follows clean architecture principles and emphasizes:

  • SOLID design principles
  • DRY (Don't Repeat Yourself) implementation
  • Comprehensive testing
  • Clear separation of concerns

License

MIT License. Copyright (c) ktsu.dev

No packages depend on ktsu.TUI.Core.

## v1.0.6 (patch) Changes since v1.0.5: - Remove legacy build scripts ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.0.5 (patch) Changes since v1.0.4: - Sync .github\workflows\dotnet.yml ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the microsoft group with 4 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump Polyfill from 9.8.0 to 9.8.1 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Bump MSTest.Sdk from 4.0.2 to 4.1.0 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump Polyfill from 9.7.7 to 9.8.0 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the ktsu group with 3 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.0.5-pre.10 (prerelease) Changes since v1.0.5-pre.9: - Bump the microsoft group with 4 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.0.5-pre.9 (prerelease) Changes since v1.0.5-pre.8: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.0.5-pre.8 (prerelease) Changes since v1.0.5-pre.7: - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.0.5-pre.7 (prerelease) Changes since v1.0.5-pre.6: - Bump Polyfill from 9.8.0 to 9.8.1 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Bump MSTest.Sdk from 4.0.2 to 4.1.0 ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.0.5-pre.6 (prerelease) Changes since v1.0.5-pre.5: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump Polyfill from 9.7.7 to 9.8.0 ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.0.5-pre.5 (prerelease) Changes since v1.0.5-pre.4: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.0.5-pre.4 (prerelease) Changes since v1.0.5-pre.3: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.0.5-pre.3 (prerelease) Changes since v1.0.5-pre.2: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.0.5-pre.2 (prerelease) Changes since v1.0.5-pre.1: - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.0.5-pre.1 (prerelease) No significant changes detected since v1.0.5. ## v1.0.4 (patch) Changes since v1.0.3: - Refactor null checks to use Ensure.NotNull for consistency ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.0.3 (patch) Changes since v1.0.2: - Add step to ensure NuGet cache directory exists in workflow ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.0.2 (patch) Changes since v1.0.1: - migrate to dotnet 10 ([@matt-edmondson](https://github.com/matt-edmondson)) - Update configuration files and scripts for improved build and test processes ([@matt-edmondson](https://github.com/matt-edmondson)) - Update BorderStyle enum and related references across the codebase ([@matt-edmondson](https://github.com/matt-edmondson)) - Enhance documentation and tags for TUI library ([@matt-edmondson](https://github.com/matt-edmondson)) - Implement Directory.Build.props and update test class access modifiers ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor TUI application classes to use target-typed new expressions and change access modifiers ([@matt-edmondson](https://github.com/matt-edmondson)) - Enhance TUI library with new features and documentation ([@matt-edmondson](https://github.com/matt-edmondson)) - Update .editorconfig settings, .gitignore entries, and various project files ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.0.2-pre.3 (prerelease) Changes since v1.0.2-pre.2: - Bump the ktsu group with 4 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.0.2-pre.2 (prerelease) Changes since v1.0.2-pre.1: - Bump Microsoft.NET.Test.Sdk from 17.14.0 to 17.14.1 ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.0.2-pre.1 (prerelease) No significant changes detected since v1.0.2. ## v1.0.1 (patch) Changes since v1.0.0: - Implement Directory.Build.props to manage warnings and errors, enhance BorderElement and TextStyle with convenience properties, and introduce InputModifiers for backward compatibility. Update tests to reflect changes in input handling and property access. ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor project files to use standard Microsoft SDKs, update package references for central management, and resolve naming conflicts in Padding model. Added Microsoft.Extensions.DependencyInjection.Abstractions package version to Directory.Packages.props. ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.0.1-pre.1 (prerelease) No significant changes detected since v1.0.1. ## v1.0.0 (major) - Add initial implementation of TUI library with core components, UI elements, and demos. Includes cursor ignore files and project configuration for package management. ([@matt-edmondson](https://github.com/matt-edmondson)) - Initial commit for TUI ([@matt-edmondson](https://github.com/matt-edmondson))

Version Downloads Last updated
1.0.7 1 02/16/2026
1.0.7-pre.1 2 02/16/2026
1.0.6 14 02/14/2026
1.0.5 14 02/14/2026
1.0.5-pre.10 52 02/10/2026
1.0.5-pre.9 51 02/06/2026
1.0.5-pre.8 53 02/05/2026
1.0.5-pre.7 51 02/03/2026
1.0.5-pre.6 53 02/03/2026
1.0.5-pre.5 53 02/01/2026
1.0.5-pre.4 52 01/31/2026
1.0.5-pre.3 53 01/31/2026
1.0.5-pre.2 52 01/31/2026
1.0.5-pre.1 52 01/30/2026
1.0.4 53 01/30/2026
1.0.3 55 01/28/2026
1.0.2 55 01/28/2026