Docs

Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Custom Field

Custom Field is a component for wrapping multiple components as a single field. It has the same features as Input Fields, such as its own label, helper, validation, and data binding. Use it to create custom input components.

Open in a
new tab
Source code
DateRangePicker.java
CustomFieldBasic.java
LocalDateRange.java
Appointment.java

Basic Usage

Custom Field is optimised for wrapping the following components:

It can also be used to provide a label, helper, and the other field features, for components that don’t have them built-in, such as List Box.

Native Input Fields

Custom Field works with native HTML elements.

Open in a
new tab
Source code
PaymentInformationField.java
CustomFieldNativeInput.java
PaymentInformation.java

Supported Features

Required Field Indicator Visibility

The visibility of the required field indicator is controlled by the has-value attribute on the Custom Field component. In Flow (Java), a class extending CustomField should take care of toggling the has-value attribute based on what values are considered empty.

Size Variants

The small theme variant can be used to make Custom Field’s label, helper, and error message smaller. Custom Field does not propagate its theme variant to its internal components, meaning each internal component’s theme variant must be set individually.

Open in a
new tab
Source code
MoneyField.java
CustomFieldSizeVariants.java
Money.java

CDC76788-C339-411B-89BF-510C3603EF59