TextButton

Input

Interactive button component.

@using Spectre.Console
@using RazorConsole.Components

<p>Count: @count</p>
<TextButton Content="Click me" OnClick="HandleClick" BackgroundColor="Color.Grey" FocusedColor="Color.Blue" />
<div>
    <Markup Content="hit enter to click the button" Foreground="Color.Green" />
</div>

@code {
    private int count = 0;
    private void HandleClick()
    {
        count++;
        StateHasChanged();
    }
}

Parameters

5
NameTypeDefaultDescription
Behavior
FocusOrderNullable<Int32>Tab order for keyboard navigation. Lower values receive focus first. If null , natural document order is used.
Appearance
BackgroundColorColorBackground color when not focused. Default is Default.
FocusedColorColorBackground color when focused. Default is DeepSkyBlue1.
Events
OnClickEventCallbackEvent callback invoked when the button is clicked.
Common
ContentStringText content displayed on the button.

API