Replacing Standard Components

You can replace a standard Flow UI component with by registering a new component and using replaceComponent().

For example, below is a complete setup that replaces TypedDatePicker everywhere in the application for its preconfigured version that sets certain attributes upfront. The setup keeps the standard datePicker XML element and loader.

Extended datePicker component:

public class ExtendedDatePicker<V extends Comparable> extends TypedDatePicker<V> {

    public static final String FAST_INPUT_DATE_FORMAT = "ddMMyyyy";

    @Override
    protected void initComponent() {
        super.initComponent();
        getThemeNames().set("align-left", true);
        getI18n().setDateFormats(
                messages.getMessage("dateFormat"),
                FAST_INPUT_DATE_FORMAT
        );
    }
}

Registration configuration:

@Configuration
public class ComponentRegistrationConfiguration {

    @Bean
    public ComponentRegistration datePicker() {
        return ComponentRegistrationBuilder.create(ExtendedDatePicker.class)
                .withComponentLoader("datePicker", DatePickerLoader.class)
                .replaceComponent(TypedDatePicker.class)
                .build();
    }
}

This approach allows you to customize behavior globally while preserving compatibility with existing views and XML descriptors.