@Tag annotation on Composite<...> doesn't work. Bug or feature?


I’m investigating how we should design our own re-usable components in our project. They are mostly made out of higher level Vaadin components.

Now, I like the fact that Composite hides away the API of T, but for some reason when we use this, the @Tag annotation does no longer work. Is there a particular reason for this? I must admit, I don’t yet fully grasp its use, so feel free to tell me my question doesn’t make any sense. :-)


I think the tag annotation should be on the component, for example on Div for Composite

A composite has no html representation on the client side.

1 Like


What would the syntax be to achieve that?

class Foo extends Composite<Div> {

doesn’t apply the @Tag() to the Div, so I suppose I could do

class Foo extends Composite<MyFooDiv>{}

class MyFooDiv extends Div{}

But that’s a bit … yuk … no?

The main driver here is to be able to just use foo {} in css. Makes it a bit more readable.

I wouldn’t use a custom tag name if it’s not a web component. For styling, you can use a css class name. That’s more standard.

1 Like

Ok, makes sense.
Thank you for your advice, Jean-Christophe .