📄 Home.razor
@page "/"
@using Microsoft.Extensions.Logging
@inject ILogger<Home> logger

<PageTitle>Receipt Printer</PageTitle>

<h1>Print a receipt!</h1>

<EditForm Model="Model" OnValidSubmit="OnSubmit" FormName="PrintForm">
    <p>
        <label>
            <span>Content:</span><br/>
            <InputTextArea rows="10" cols="50" @bind-value="Model!.Content" />
        </label>
    </p>
    <p>
        <button type="submit">Print!</button>
    </p>
</EditForm>

@code {
    [SupplyParameterFromForm]
    public PrintForm? Model { get; set; }

    protected override void OnInitialized() => Model ??= new();

    private async Task OnSubmit()
    {
        logger.LogInformation("Printing receipt with content: {Content}", Model!.Content);

        Model = new();
    }

    public sealed record PrintForm
    {
        public string Content { get; set; } = string.Empty;
    }
}