SharpConsoleUI is a terminal GUI framework for .NET — not just a TUI library, but a full retained-mode GUI framework that targets the terminal as its display surface. Cross-platform (Windows, Linux, macOS).
The rendering engine follows the same architecture as desktop GUI frameworks like WPF and Avalonia: a Measure → Arrange → Paint layout pipeline, double-buffered compositing with occlusion culling, and a unified cell pipeline where ANSI never crosses layer boundaries. The terminal is just the rasterization target.
- GUI-grade rendering engine — DOM-based layout, three-level dirty tracking, occlusion culling, adaptive Cell/Line/Smart rendering modes
- Multi-window with per-window threads — each window updates independently without blocking others
- Rich markup everywhere — just
[bold red]text[/]and it works, no complex styling APIs - Any Spectre.Console widget works as a control — Tables, BarCharts, Trees, Panels — wrap any
IRenderable - 30+ built-in controls — buttons, lists, trees, tables, text editors, dropdowns, menus, tabs, and more
- Full Unicode & emoji support — CJK, Arabic, Hebrew, Thai, Devanagari, combining marks, variation selectors, ZWJ sequences — accurate wcwidth-based cell measurement
- Compositor effects — PreBufferPaint/PostBufferPaint hooks for custom rendering, transitions, or even games
- MVVM-compatible — all controls implement
INotifyPropertyChanged; one-way and two-way data binding withBind()/BindTwoWay() - Fluent builders for windows, controls, and layouts
Visit the project website: nickprotop.github.io/ConsoleEx
Browse examples with screenshots: EXAMPLES.md
Watch SharpConsoleUI in action on YouTube
Rich controls, multiple windows, smooth gradients, real-time updates, and full-screen capabilities
dotnet add package SharpConsoleUIusing SharpConsoleUI;
using SharpConsoleUI.Builders;
using SharpConsoleUI.Drivers;
var windowSystem = new ConsoleWindowSystem(new NetConsoleDriver(RenderMode.Buffer));
var window = new WindowBuilder(windowSystem)
.WithTitle("Hello World")
.WithSize(50, 15)
.Centered()
.WithColors(Color.White, Color.DarkBlue)
.Build();
windowSystem.NotificationStateService.ShowNotification(
"Welcome", "Hello World!", NotificationSeverity.Info);
windowSystem.AddWindow(window);
windowSystem.Run();dotnet new install SharpConsoleUI.Templates
dotnet new tui-app -n MyApp # Starter app with list, button, notification
dotnet new tui-dashboard -n MyDash # Fullscreen dashboard with tabs and live metrics
dotnet new tui-multiwindow -n MyApp # Two windows with master-detail pattern
cd MyApp && dotnet runPackage your app so end users can double-click to launch — no terminal knowledge required:
# Initialize terminal config for your project
schost init
# Launch in a configured terminal window (what the user will see)
schost run
# Package as portable zip + optional installer
schost pack --installerschost opens your app in Windows Terminal (or Linux terminal emulator) with custom title, font, colors, and size. The app uses the real terminal — no compatibility layer. See the schost guide for details.
| Category | Controls |
|---|---|
| Text & Display | MarkupControl, FigleControl, RuleControl, SeparatorControl, SparklineControl, BarGraphControl, LogViewerControl |
| Input | ButtonControl, CheckboxControl, PromptControl, DropdownControl, MultilineEditControl |
| Data | ListControl, TreeControl, TableControl (interactive DataGrid with virtual data, sorting, editing), HorizontalGridControl |
| Navigation | MenuControl, ToolbarControl, TabControl, NavigationView |
| Layout | ColumnContainer, SplitterControl, ScrollablePanelControl, PanelControl |
| Drawing | CanvasControl, ImageControl (PNG/JPEG/BMP/GIF/WebP/TIFF via ImageSharp) |
| Advanced | SpectreRenderableControl (wraps any Spectre.Console IRenderable), ProgressBarControl, TerminalControl |
See the Controls Reference for detailed documentation on each control.
Each window can run with its own async thread, enabling true multi-threaded UIs:
var clockWindow = new WindowBuilder(windowSystem)
.WithTitle("Digital Clock")
.WithSize(40, 12)
.WithAsyncWindowThread(async (window, ct) =>
{
while (!ct.IsCancellationRequested)
{
var time = window.FindControl<MarkupControl>("time");
time?.SetContent(new List<string> { $"[bold cyan]{DateTime.Now:HH:mm:ss}[/]" });
await Task.Delay(1000, ct);
}
})
.Build();Event handlers include a window parameter for cross-control interaction via FindControl<T>():
window.AddControl(Controls.Button("Submit")
.OnClick((sender, e, window) =>
{
var input = window.FindControl<PromptControl>("nameInput");
var status = window.FindControl<MarkupControl>("status");
status?.SetContent($"[green]Submitted:[/] {input?.Text}");
})
.Build());// Notifications
windowSystem.NotificationStateService.ShowNotification("Title", "Message", NotificationSeverity.Info);
// Debug logging (file-based, never console)
// export SHARPCONSOLEUI_DEBUG_LOG=/tmp/consoleui.log
windowSystem.LogService.LogAdded += (s, entry) => { /* handle */ };
// State services: Focus, Modal, Window, Theme, Cursor, etc.
windowSystem.FocusStateService.FocusedWindow;
windowSystem.ModalStateService.HasModals;// Built-in themes with runtime switching
windowSystem.ThemeRegistry.SetTheme("ModernGray");
// Plugin system
windowSystem.PluginStateService.LoadPlugin<DeveloperToolsPlugin>();Direct buffer access for custom backgrounds, post-processing, and transitions:
window.Renderer.PreBufferPaint += (buffer, dirty, clip) =>
{
// Render custom background before controls
};
window.Renderer.PostBufferPaint += (buffer, dirty, clip) =>
{
// Apply post-processing effects after controls
};┌─────────────────────────────────────────────────────────────┐
│ Application Layer (Your Code) │
│ └── Window Builders, Event Handlers, Controls │
├─────────────────────────────────────────────────────────────┤
│ Framework Layer │
│ ├── Fluent Builders, State Services, Logging, Plugins │
├─────────────────────────────────────────────────────────────┤
│ Layout Layer │
│ ├── DOM Tree (LayoutNode) — Measure → Arrange → Paint │
├─────────────────────────────────────────────────────────────┤
│ Rendering Layer │
│ ├── Multi-pass compositor, occlusion culling, portals │
├─────────────────────────────────────────────────────────────┤
│ Buffering Layer │
│ ├── CharacterBuffer → ConsoleBuffer → adaptive diff output │
├─────────────────────────────────────────────────────────────┤
│ Driver Layer │
│ ├── NetConsoleDriver (production) / Headless (testing) │
│ └── Raw libc I/O (Unix) / Console API (Windows) │
└─────────────────────────────────────────────────────────────┘
The native markup parser converts [bold red]text[/] directly into typed Cell structs — no ANSI intermediate format. Everything flows as cells through CharacterBuffer → ConsoleBuffer → terminal output.
| ServerHub TUI server monitoring and management dashboard for Linux. Real-time metrics, logs, and remote control from your terminal with 14 bundled widgets. |
|
| LazyNuGet TUI for managing NuGet packages across .NET solutions. Search, update, and manage dependencies with multi-source support and dependency trees. |
|
| LazyDotIDE Lightweight console-based .NET IDE with LSP IntelliSense, built-in terminal, and git integration. Works over SSH, in containers, anywhere you have a console. |
Using SharpConsoleUI in your project? Open a PR to add it to this list!
git clone https://github.com/nickprotop/ConsoleEx.git
cd ConsoleEx
dotnet build
dotnet run --project Examples/DemoApp| Guide | Description |
|---|---|
| Examples Gallery | All examples with screenshots |
| Fluent Builders | WindowBuilder and control builder APIs |
| Controls Reference | Complete guide to all 30+ UI controls |
| Markup Syntax | Markup tags, colors, decorations |
| Built-in Dialogs | File pickers, folder browsers |
| Configuration | System configuration reference |
| Themes | Built-in themes, custom themes, runtime switching |
| State Services | Window state, focus, modal, notification services |
| Plugins | Plugin architecture and development |
| Compositor Effects | Buffer manipulation and visual effects |
| DOM Layout System | Layout engine internals |
| Rendering Pipeline | Rendering architecture details |
| Portal System | Floating portals and overlay system |
| Status System | Status bars, window task bar, Start Menu |
| Desktop Host (schost) | Launch, package, and distribute TUI apps as desktop apps |
API Reference: nickprotop.github.io/ConsoleEx
MIT License — see LICENSE.txt.
- Spectre.Console integration via SpectreRenderableControl
- Unix raw I/O approach inspired by Terminal.Gui v2
SharpConsoleUI was initially developed manually with core windowing functionality and double-buffered rendering. The project evolved to include modern features (DOM-based layout system, fluent builders, plugin architecture, theme system) with AI assistance. Architectural decisions and feature design came from the project author, while AI generated code implementations based on those decisions.
Made for the .NET console development community

