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

7
NameTypeDefaultDescription
Behavior
FocusOrderNullable<Int32>—Tab order for keyboard navigation. Lower values receive focus first. If null, natural document order is used.
Appearance
BackgroundColorColor—Background color when not focused. Default is Default.
FocusedColorColor—Background color when focused. Default is DeepSkyBlue1.
HoverColorColor—Background used when the pointer is over an actionable button.
HoverForegroundColorColor—Text color paired with HoverColor.
Events
OnClickEventCallback—Event callback invoked when the button is clicked.
Common
ContentString—Text content displayed on the button.

API