HxInputPercent

Numeric input in percentages with value normalization (0% = 0, 100% = 1.0).

Basic example

%
Entered value: 0
<HxInputPercent @bind-Value="input" Decimals="1" />

Entered value: @input

@code {
    private decimal input;
}

InputGroupEnd

InputGroupEnd is set to "%" by default.

Custom InputGroupEnd
<HxInputPercent InputGroupEndText="Custom InputGroupEnd" @bind-Value="input" />

@code {
    private decimal input;
}

If you do not want any InputGroupEnd to appear, then set the parameter to null or String.Empty.

<HxInputPercent InputGroupEndText="" @bind-Value="input" />

@code {
    private decimal input;
}

API

Parameters

Name Type Description
ParsingErrorMessage string Gets or sets the error message used when displaying an a parsing error. Used with String.Format(...), {0} is replaced by Label property, {1} name of bounded property.
Placeholder string Placeholder for the input.
InputSize InputSize?
LabelType LabelType? Label type.
Decimals int? Gets or sets the number of decimal digits. Can be used only for floating point types, for integer types throws exception. When not set, 2 decimal digits are used.
InputGroupStartText string Input-group at the beginning of the input.
InputGroupStartTemplate RenderFragment Input-group at the beginning of the input.
InputGroupEndText string Input-group at the end of the input.
InputGroupEndTemplate RenderFragment Input-group at the end of the input.
Label string Label to render before input (or after input for Checkbox).
LabelTemplate RenderFragment Label to render before input (or after input for Checkbox).
Hint string Hint to render after input as form-text.
HintTemplate RenderFragment Hint to render after input as form-text.
CssClass string Custom CSS class to render with wrapping div.
LabelCssClass string Custom CSS class to render with the label.
InputCssClass string Custom CSS class to render with the input element.
ShowValidationMessage bool When false, validation message is not rendered. Default is true.
GenerateChip bool When true, HxChipGenerator is used to generate chip item(s). Default is true.
ChipTemplate RenderFragment Chip template.
Enabled bool? When null (default), the Enabled value is received from cascading FormState. When value is false, input is rendered as disabled. To set multiple controls as disabled use HxFormState.
AdditionalAttributes IReadOnlyDictionary<string, object>
Value object
ValueExpression Expression<Func<object>>
DisplayName string

Event Callbacks

Name Type Description
ValueChanged EventCallback<object>

Methods

Method Returns Description
FocusAsync() ValueTask Gives focus to the input element.
An unhandled error has occurred. Reload 🗙