RazorConsole is an open-source .NET library that lets developers build rich, interactive terminal user interfaces (TUIs) using familiar Razor component syntax — the same model behind Blazor web development — instead of manually handling keyboard events, screen refreshing, and layout math.
Key points
- Core concept: RazorConsole translates Razor components (e.g.,
<Rows>,<TextButton>) into terminal-renderable objects. It sits on top of Spectre.Console and fills the gap between Spectre.Console's beautiful-but-mostly-static output and traditional TUI frameworks like Gui.cs. - How it works: 1. Author components in Razor syntax. 2. At runtime, a Virtual DOM (a tree of VNodes) captures UI state and changes. 3. A Translator pipeline (built-in + custom) converts VNodes into Spectre.Console
- Custom translators implement
IVdomElementTranslator; hot reload via metadata handlers makes iteration fast. - Getting started (roughly 10 minutes):
dotnet add package RazorConsole.Core- Change the SDK in the
.csprojtoMicrosoft.NET.Sdk.Razor. - In
Program.cs, build a host and call.UseRazorConsole<Counter>(), thenBuild()andRunAsync(). - Built-in components (25+):
- Layout:
Rows,Columns,FlexBox,Grid,Align,Padder - Containers:
Panel,Border - Text:
Markup,Figlet,Newline - Charts:
BarChart,BreakdownChart,StepChart,SpectreCanvas - Interactive:
TextButton(OnClick),TextInput(ValueChanged, password masking),Select,Spinner,Scrollable - Tables/code:
Table,SyntaxHighlighter(HTML-like<thead><tr><th>syntax) - Highlighted examples:
- LLMAgentTUI: a Claude Code-style LLM chat TUI integrating the Microsoft.Extensions.AI SDK with OpenAI or Ollama, featuring streaming output, conversation history, and spinner loading states.
- LoginForm: form validation, password masking, error messages.
- FileExplorer and MultipageApp: keyboard-navigable file browsing and multi-page structure.
- A Counter demo demonstrates state management and event binding in a few lines of Razor.
- Ecosystem: a
razorconsole-galleryglobal dotnet tool previews all components interactively; a Discord community, Git LFS-based contribution workflow, xUnit tests, and Codecov coverage support the project. A developer used it to build the game *Waves* for GitHub Game Off 2025.
IRenderable objects.
4. Spectre.Console handles rendering and the keyboard/mouse event loop.
Project status
As of March 26, 2026: ~1.7k GitHub stars, 44 forks, MIT license, latest stable release v0.5.0 (March 17), with active rapid iteration. Documentation is still maturing; the design doc covers advanced features.
Assessment
For developers who already know Razor/Blazor, RazorConsole offers a low learning curve, strong extensibility, and Spectre.Console's polished rendering for free. Weaknesses are the early version and incomplete docs. It is particularly well suited to building agentic TUIs — AI assistant interfaces, live dashboards, and keyboard-driven tools.
References
1. GitHub repository: https://github.com/RazorConsole/RazorConsole 2. Official site: https://razorconsole.github.io/RazorConsole/ 3. Spectre.Console documentation (underlying rendering engine) 4. Microsoft.Extensions.AI SDK integration (LLMAgentTUI basis) 5. .NET Razor SDK and Blazor component model documentation