Hide label of component when not empty if added to a form item

I have different type of components with their labels set. These components are sometimes added to a FormLayout using the addFormItem(component, component.getLabel()).
The result is to have a label on the left (FormItem label slot) and the top (component’s label part). Is there a way to hide the latter when within a FormItem?

The easiest way would be just to set the Component’s label to an empty String after you call addFormItem.

Thank you Olli,

Although we thought of this approach, we were hoping to be able to hide it without clearing the label’s value, given that the same component may be used in different layouts.

An approach that I will test now is using the :host-context and hide the label when within a vaadin-form-item