Build TUI with Razor Component
Bring a familiar web-development experience to .NET terminal apps. Compose reusable Razor components, manage state in C#, and handle input with built-in events.
<div data-focusable="true"
@onkeydown="OnKey"
@onmouseenter="() => _hovered = true"
@onclick="() => _clicks++">
<Panel BorderColor="@(_hovered ? Color.Yellow : Color.Blue)">
<Markup Content="@($"Key: {_key} · Clicks: {_clicks}")" />
</Panel>
</div>
@code {
bool _hovered;
int _clicks;
string _key = "none";
void OnKey(KeyboardEventArgs e) => _key = e.Key;
}Why choose RazorConsole?
Razor components for the terminal
Use the component model you know from web development for interactive tools, dashboards, and forms.
Built-in mouse and keyboard events
Wire up clicks, hover, and key handlers directly in Razor. Follow the setup and terminal-support guidance for interactive input.
NativeAOT-compatible distribution
Publish native apps that need no installed .NET runtime and avoid JIT warm-up at startup. Support is experimental: check platform build tools, trimming, and third-party dependencies.
Choose RazorConsole when you want Razor composition and event-driven interaction in a C# terminal UI. Spectre.Console is part of its rendering foundation, not a mutually exclusive alternative. Compare .NET terminal UI approaches.
Frequently asked questions
What is RazorConsole?
RazorConsole is a C#/.NET framework for terminal user interfaces built with Razor components. It renders to terminal cells, not browser HTML. See the interactive tutorial for an introduction.
Do I need a web server or Blazor hosting?
No. A native RazorConsole application runs in the terminal without a web server. You can reuse your Razor component experience, but terminal layout and supported components differ from the browser: existing web pages cannot be assumed to work unchanged. The website's browser demos are a separate way to try the framework. Start with the Hello World tutorial.
How is it related to Spectre.Console?
Spectre.Console is part of RazorConsole's rendering foundation. RazorConsole adds a Razor component authoring and interaction model; it is not a replacement for every use of Spectre.Console. The .NET TUI comparison explains when to evaluate each approach.
Does it support mouse and keyboard input?
Yes. Built-in events let Razor components handle keys, clicks, and hover. Focus, terminal capabilities, and configuration still matter; native hosts must enable mouse reporting. Follow the keyboard guide and mouse tutorial, and keep a keyboard path for essential actions.
Can I publish with NativeAOT?
Yes, with experimental support. Native publishing can remove the need for an installed .NET runtime and avoid JIT warm-up, but does not guarantee a measured startup time. Check platform build tools, trimming and reflection, third-party dependencies, and required assets. Build for each target platform and read the Native AOT requirements.
How do I get started?
Follow the interactive tutorial to build your first component, then explore state, input, and layout. Browse component examples to see what you can compose.