Built-in Components

RazorConsole ships with a library of Spectre.Console-powered components covering layout, input, display, and utility scenarios. You can combine them just like regular Razor components to build rich terminal experiences.

Layout

ComponentHighlights
AlignCenters or aligns child content horizontally/vertically with optional fixed width/height.
ColumnsFlows children left-to-right, optionally expanding to fill the console width.
RowsStacks children vertically, great for wizard-style layouts.
GridBuilds a multi-column layout with configurable column count and width.
PadderAdds Spectre padding around nested content to create spacing.
ScrollableRenders a sliding window of items (PageSize) with built-in keyboard navigation (Arrow keys, PageUp/Down).
<Columns Expand>
    <Markup Content="Step 1" />
    <Markup Content="Step 2" />
    <Markup Content="Step 3" />
</Columns>

Input

ComponentHighlights
TextButtonFocusable button with customizable colors and click handlers via EventCallback.
TextInputCollects user input with placeholder, change handler, and optional password masking.
SelectKeyboard-driven dropdown with highlighted selection state and callbacks.
<TextInput Value="@name" ValueChanged="@((v) => name = v)" Placeholder="Enter your name" />
<TextButton Content="Submit" OnClick="HandleSubmit" />

Display

ComponentHighlights
MarkupRenders Spectre markup with color, background, and text decoration support.
PanelCreates framed sections with optional title and border styling.
BorderWraps child content in a configurable border and padding.
BarChartVisualizes numeric data as horizontal bars with customizable styling, labels, and scaling.
BreakdownChartDisplays proportional data segments (pie-style) with optional legends and percentage values.
StepChartPlots discrete values over time using Unicode box-drawing characters and multiple series.
FigletProduces large ASCII headers using Figlet fonts.
SyntaxHighlighterDisplays colorized source code with optional line numbers.
SpectreCanvasProvides a low-level pixel buffer for drawing custom graphics or pixel art.
MarkdownRenders Markdown text directly in the console.
TableConverts semantic <table> markup into Spectre tables.
<Panel Title="Server Status" BorderColor="Color.Green" Expand>
    <Columns>
        <Markup Content="✓ Online" Color="Color.Green" />
        <Markup Content="Latency: 42ms" Color="Color.Yellow" />
    </Columns>
    <BarChart
        Width="40"
        BarChartItems="@items"
        Label="Load Distribution" />
</Panel>

Utilities

ComponentHighlights
SpinnerAnimated progress indicator with optional message.
NewlineEmits an empty line to separate sections.
<Spinner Message="Fetching data..." />

Tips

  • All components can be composed within one another—wrap inputs inside Panel, place buttons in Columns, etc.
  • Spectre colors map to Spectre.Console.Color; use Color.Red, Color.Blue, or RGB constructors for precise styling.
  • Prefer EventCallback parameters for handlers so components remain async-friendly.
  • Combine with RazorConsole focus management features to deliver intuitive keyboard navigation.