Skip to content

Currency Input

Currency Input is a specialization of the masked-input caret bridge: the bound value is a decimal?, never a string. On every keystroke, C# parses the digits and reformats them via NumberFormatInfo (grouping, decimal separator, symbol) and re-lands the caret by counting digits. Min / Max clamp on blur and the fraction pads to MinFractionDigits.

@using Navius.Primitives.Components.CurrencyInput
<NaviusCurrencyInput @bind-Value="_amount" Currency="EUR" />
Prop Type Default Description
Value decimal? - Controlled value. Pair with ValueChanged (@bind-Value).
ValueChanged EventCallback<decimal?> - Fires when the controlled Value should change.
DefaultValue decimal? - Initial value when used uncontrolled.
Culture CultureInfo? current Drives symbol, grouping and decimals.
Currency string? - ISO 4217 code; overrides the culture’s default currency symbol.
MinFractionDigits int? culture Minimum fraction digits (blur padding).
MaxFractionDigits int? culture Maximum fraction digits (typing cap).
AllowNegative bool false Whether a negative sign is accepted.
Min decimal? - Clamped on blur.
Max decimal? - Clamped on blur.
ShowSymbol bool true Whether the currency symbol renders in the value.
Disabled bool false -
Invalid bool false Reflected as data-invalid.
Attributes IDictionary<string, object>? - Forwarded to the rendered input.
Part Attribute Description
Root data-navius-currency-input Present on the input.
Root data-empty Present when the value is null.
Root data-negative Present when the value is negative.
Root data-invalid Present when Invalid is set.

Currency Input renders a plain input with inputmode="decimal" and no additional role; pair it with a Label for an accessible name. aria-invalid="true" and data-invalid both reflect the Invalid prop, and data-negative lets a skin color a negative amount. Covered by the Playwright browser test suite.