Skip to main content
Any Framework

Build interactive console applications using .NET Razor

Published
Oct 11, 2025
1y ago
Total Downloads
21.4K
21,372

Install

dotnet add package RazorConsole.Gallery --version 0.0.3-alpha.4657e6

No framework information available.

README

RazorConsole

NuGet License

Build interactive console applications with .NET Razor and Spectre.Console

Install

dotnet add package RazorConsole.Core

Usage

// Counter.razor
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using RazorConsole.Components

<Columns>
    <p>Current count</p>
    <Markup Content="@currentCount.ToString()" Foreground="@Spectre.Console.Color.Green" />
</Columns>
<TextButton Content="Click me"
            OnClick="IncrementCount"
            BackgroundColor="@Spectre.Console.Color.Grey"
            FocusedColor="@Spectre.Console.Color.Blue" />


@code {
    private int currentCount = 0;
    private void IncrementCount()
    {
        currentCount++;
    }
}

// Program.cs
await AppHost.RunAsync<Counter>();

Image

Built-in components

RazorConsole ships with a catalog of ready-to-use components that wrap Spectre.Console constructs:

  • Align – position child content horizontally and vertically within a fixed box.
  • Border – draw Spectre borders with customizable style, color, and padding.
  • Columns – arrange items side-by-side, optionally stretching to fill the console width.
  • Figlet – render big ASCII art text using FIGlet fonts.
  • Grid – build multi-row, multi-column layouts with precise cell control.
  • Markup – emit styled text with Spectre markup tags.
  • Newline – insert intentional spacing between renderables.
  • Padder – add outer padding around child content without altering the child itself.
  • Panel – frame content inside a titled container with border and padding options.
  • Rows – stack child content vertically with optional expansion behavior.
  • Select – present a focusable option list with keyboard navigation.
  • Spinner – show animated progress indicators using Spectre spinner presets.
  • SyntaxHighlighter – colorize code snippets using ColorCode themes.
  • TextButton – display clickable text with focus and pressed-state styling.
  • TextInput – capture user input with optional masking and change handlers.

See design-doc/builtin-components.md for the full reference, including parameters and customization tips.

Component Gallery

Explore the built-in components interactively with the RazorConsole Component Gallery. Install the tool globally and launch it from any terminal:

dotnet tool install --global RazorConsole.Gallery --version 0.0.2-alpha.181b79

After installation, run razorconsole-gallery to open the showcase and browse component examples rendered in the console. The gallery includes quick links back to this README for more details.

Component Gallery

HotReload

RazorConsole supports hotreload via metadata update handler so you can apply UI changes on the fly.

Community & support

  • File issues using the GitHub Issues tab.

License

This project is distributed under the MIT License. See LICENSE for details.

Changes from Previous Version

No structural changes between v0.0.2-alpha.181b79 and v0.0.3-alpha.4657e6.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.