Skip to content
GitHub11 stars

A numeric input element with increment and decrement buttons, and a scrub area.

<NumberFieldRoot Value="100" class="number-field-field">
    <NumberFieldScrubArea class="number-field-scrub-area">
        <label for="@_id" class="number-field-label">

Usage guidelines

  • Form controls must have an accessible name: Give it one with a <label> element or the Field parts.

Anatomy

Import the primitives and assemble the parts:

@using Blazix.Primitives

<NumberFieldRoot>
    <NumberFieldScrubArea>
        <NumberFieldScrubAreaCursor />
    </NumberFieldScrubArea>
    <NumberFieldGroup>
        <NumberFieldDecrement />
        <NumberFieldInput />
        <NumberFieldIncrement />
    </NumberFieldGroup>
</NumberFieldRoot>

API Reference

NumberFieldRoot

Renders a <div> element.

ParameterTypeDefault
Value double? -
ValueChanged

Called with the new value when Value changes, for @bind-Value.

EventCallback<double?> -
OnValueChange

Runs before the value changes, with the reason; call Cancel() to keep it.

EventCallback<ValueChangeEventArgs<double?>> -
OnValueCommitted EventCallback<double?> -
Min

The minimum value.

double? -
Max

The maximum value.

double? -
Step

The amount the value changes by with the arrow keys or the buttons.

double 1
SmallStep double 0.1
LargeStep double 10
SnapOnStep bool false
AllowOutOfRange bool false
AllowWheelScrub bool false
Disabled

Whether the component should ignore user interaction.

bool false
ReadOnly

Whether the user should be unable to change the value. It stays focusable.

bool false
Required

Whether the user must enter a value before submitting a form.

bool false
Name string? -
Format string? -
Culture

The culture the value is formatted with.

CultureInfo? -
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-

NumberFieldInput

Renders a <input> element.

ParameterTypeDefault
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-

NumberFieldGroup

Renders a <div> element.

ParameterTypeDefault
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-

NumberFieldScrubArea

Renders a <span> element.

ParameterTypeDefault
Direction Orientation Orientation.Horizontal
PixelSensitivity int 2
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-

NumberFieldScrubAreaCursor

Renders a <span> element.

ParameterTypeDefault
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-

NumberFieldDecrement

Renders a <button> element.

ParameterTypeDefault
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-

NumberFieldIncrement

Renders a <button> element.

ParameterTypeDefault
Render RenderFragment<NumberFieldRenderProps>? -
ChildContent

The part's content.

RenderFragment? -

Other attributes are passed to the element it renders.

AttributeType
data-disabled

Present when the number field is disabled.

-
data-readonly

Present when the number field is readonly.

-
data-required

Present when the number field is required.

-
data-valid

Present when the number field is in a valid state (when wrapped in FieldRoot).

-
data-invalid

Present when the number field is in an invalid state (when wrapped in FieldRoot).

-
data-dirty

Present when the number field's value has changed (when wrapped in FieldRoot).

-
data-touched

Present when the number field has been touched (when wrapped in FieldRoot).

-
data-filled

Present when the number field is filled (when wrapped in FieldRoot).

-
data-focused

Present when the number field is focused (when wrapped in FieldRoot).

-
data-scrubbing

Present while scrubbing.

-