numberField

Basics

An example of numberField:

<numberField clearButtonVisible="true"
             value="234.433"/>
number field basics
numberField doesn’t handle formatting. Use TypedTextField when you need localized number formatting or support for different data types.

Data Binding

Data binding refers to linking a visual component to a data container. Changes in the visual component or corresponding data container can trigger updates to one another. See Using Data Components for more details.

The following example produces a data-aware numberField. The entity attribute must be of a numeric type.

<data>
    <instance class="com.company.onboarding.entity.Step" id="stepDc">
        <fetchPlan extends="_base"/>
        <loader id="stepDl"/>
    </instance>
</data>
<layout>
    <numberField dataContainer="stepDc" property="factor"
                 step="0.5" stepButtonsVisible="true"/>
</layout>
number field data binding

Validation

To check values entered into the numberField component, you can use a validator in a nested validators element.

The following predefined validators are available for numberField:

XML Element

validators

Predefined validators

custom - doubleMax - doubleMin - negative - negativeOrZero - notNull - positive - positiveOrZero

Theme Variants

Use themeNames attribute to set a component theme.

Variant Description Supported By

small

Makes the component smaller.

Aura, Lumo

align-left

Aligns the field value to the left side.

Aura, Lumo

align-center

Centers the field value.

Aura, Lumo

align-right

Aligns the field value to the right side.

Aura, Lumo

helper-above-field

Renders the helper text above the field, below the label.

Aura, Lumo

See Also

See the Vaadin Docs for more information.