Composition with CustomComponent vs Layouts

Hi there, I’m new to Vaadin very impressed so far. I’m just wondering with regards to composition, what the difference is using CustomComponent vs plain layouts? Are there specific benefits of using CustomComponent? Otherwise I’m not sure what the purpose of i is vs just using a panel or any type of layout.

Custom components are used to segregate/modularize functionality. Say for example you have a search form and a table for showing results, with the search form containing a number of different fields…

You could just do all of this within a layout, but your code will get unwieldy when it grows.

If you encapsulate the search form into a custom component, you can segregate the code handling the form from the rest of the code and treat it as a single component.

Great, thanks for the explanation!