Component or widget


I study Vaadin and I seek to know when develop a custom vaadin component and when develop a custom vaadin widget?

Thanks for your advice.

See you soon. :wink:

That is a rather broad question. The simple answer is: if you can’t do what you want with a (server-side) custom component, but you can do it with a (client-side) custom widget, then that’s what you need to do.

Server-side component customization (by extending them) and composition (with CustomComponent or by extending layouts) is usually the easiest and preferred way to add functionality to components or create new components.

Server-side customization has much tighter limits than what you can do with client-side widgets, so if you want something that really isn’t supported by the Vaadin widgets or the server-side API, you need to make custom widgets.

I personally always try to find a server-side solution, even a tricky solution that maybe uses CSS tricks. Only if it’s completely impossible to do that way, I use a client-side solution (custom widget, component extension, or with Grid a custom renderer).

Thanks for your explanation. Also I prefer don’t use the Widgets. But I wanted to be sure of this choice.

Bye. :wink: