NeoKolors.Tui.Elements 2026.4.0-preview.4

This is a prerelease version of NeoKolors.Tui.Elements.
dotnet add package NeoKolors.Tui.Elements --version 2026.4.0-preview.4
                    
NuGet\Install-Package NeoKolors.Tui.Elements -Version 2026.4.0-preview.4
                    
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="NeoKolors.Tui.Elements" Version="2026.4.0-preview.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NeoKolors.Tui.Elements" Version="2026.4.0-preview.4" />
                    
Directory.Packages.props
<PackageReference Include="NeoKolors.Tui.Elements" />
                    
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 NeoKolors.Tui.Elements --version 2026.4.0-preview.4
                    
#r "nuget: NeoKolors.Tui.Elements, 2026.4.0-preview.4"
                    
#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 NeoKolors.Tui.Elements@2026.4.0-preview.4
                    
#: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=NeoKolors.Tui.Elements&version=2026.4.0-preview.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NeoKolors.Tui.Elements&version=2026.4.0-preview.4&prerelease
                    
Install as a Cake Tool

NeoKolors.Tui.Elements

Build & Test NuGet Version NuGet Downloads License

NeoKolors.Tui.Elements provides the declarative, component-driven UI element tree for the NeoKolors TUI framework. It includes flexible layout panels, bordered frames, interactive buttons, tabular data grids, lists, styled text blocks, and mouse event dispatching.


Component Suite

Component Class Description
Flex [Flex Web-inspired flexbox layout container supporting row/column directions, justify content, cross-axis alignment, wrapping, and item gap spacing.
Grid [Grid 2D tabular layout supporting row/column definitions, column/row spanning, and proportional (star), auto, and fixed sizing.
Border [Border Framing container providing stylized box outlines (NKBorderStyle), padding, margin, title labels, and background colors.
Button [Button Interactive command button supporting hover and pressed visual states, custom child content, and click event delegates.
Table [Table Rich tabular data visualizer with column definitions, cell formatting, headers, and borders.
List [List Structured list view supporting bullet/numbered list point generators and selectable items.
Text [Text High-performance text element supporting plain and ANSI strings, word wrapping, alignment, and trimming.
MouseRegion [MouseRegion Spatial interaction boundary registered in a HitMap to intercept mouse clicks, movements, and scroll events.
ElementsMouseDispatcher [ElementsMouseDispatcher Dispatches incoming terminal mouse events to the corresponding registered element callbacks.

Core Usage

1. Flexbox Layout (Flex)

Flex arranges children linearly along a main axis while aligning them across a cross axis:

using NeoKolors.Tui.Elements;

var flex = new Flex {
    Direction = FlexDirection.Row,       // Row or Column
    Justify = FlexJustify.SpaceBetween,  // Start, Center, End, SpaceBetween, SpaceAround
    Align = FlexAlign.Center,            // Start, Center, End, Stretch
    Wrap = FlexWrap.NoWrap,
    Gap = 2                              // Space between items in character cells
};

flex.Add(new Text("Left Item"));
flex.Add(new Text("Right Item"));

2. Framed Containers (Border)

Border wraps any child IElement with a stylized outline:

using NeoKolors.Common;
using NeoKolors.Tui.Core;
using NeoKolors.Tui.Elements;

var innerContent = new Text("System Status: Online");

var box = new Border(innerContent) {
    Title = " Diagnostics ",
    Padding = new Spacing(2, 1),
    Style = NKBorderStyle.GetRounded(NKColor.FromRgb(0, 220, 180))
};

3. Interactive Buttons (Button)

Button triggers click callbacks and transitions visual styles when the mouse cursor hovers over it:

using NeoKolors.Common;
using NeoKolors.Tui.Elements;

var btn = new Button {
    Text = " [ Submit Order ] ",
    NormalStyle = new NKStyle(NKColor.FromRgb(255, 255, 255), NKColor.FromRgb(40, 80, 160), TextStyles.Bold),
    HoverStyle = new NKStyle(NKColor.FromRgb(255, 255, 255), NKColor.FromRgb(60, 120, 240), TextStyles.Bold)
};

btn.OnClick += () => {
    NKConsole.WriteLine("Button clicked!");
};

4. Tabular Data Layout (Table and Grid)

using NeoKolors.Tui.Elements;

var table = new Table();
table.AddColumn("ID", width: 6);
table.AddColumn("Process Name", width: 20);
table.AddColumn("CPU %", width: 10);

table.AddRow("1042", "dotnet", "1.4%");
table.AddRow("2180", "terminal", "0.2%");

5. Mouse Dispatching (ElementsMouseDispatcher)

When rendering an element tree using NKAppView, elements automatically register their screen coordinates in the view's HitMap. Use ElementsMouseDispatcher to forward mouse events from NKConsole:

var hitMap = new HitMap();
var mouseDispatcher = new ElementsMouseDispatcher();

// In your input loop or event handler:
NKConsole.Mouse += mouseEvent => {
    mouseDispatcher.Dispatch(hitMap, mouseEvent);
    view.Invalidate();
};
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 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.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on NeoKolors.Tui.Elements:

Package Downloads
NeoKolors.Tui

Package Description

NeoKolors.Tui.Lifecycle.Apps

Package Description

NeoKolors.Tui.Widgets

Package Description

NeoKolors.Tui.Lifecycle.Inline

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.4.0-preview.4 69 11/15/2026
2026.4.0-preview.3 84 11/1/2026
2026.4.0-preview.2 79 10/30/2026
2026.4.0-preview.1 83 10/23/2026