If you bind to a decimal it seems it will keep the number of decimals you specify for the value, even training zeros.
@page "/"
<EditForm Model=@Account>
<InputNumber @bind-Value=Account.Balance/>
<button>Submit</button>
</EditForm>
@code
{
BankAccount Account = new BankAccount();
public class BankAccount
{
public decimal Balance { get; set; } = 23.300;
}
}
For floats and doubles I would have expected the following to work
<InputNumber @bind-Value=Account.Balance @bind-Value:format="F2"/>
But it seems only DateTime and DateTimeOffset are supported, which is a shame.
There is an example on Blazor University showing how to descend from InputBase to create your own input controls. It would be quite trivial to implement a control that honours the format.
https://blazor-university.com/forms/descending-from-inputbase/