How to extends vaadin-textfield with LitTemplate?

Probably a stupid question but I have to create a “CopiableTextfield” where the suffix slot contains a button allowing the user to copy the value (and display a “Copied” notification).

Currently, on java side I created my CopiableTextField extending TextField and I just add manually the button + the clickListener executing the JS function to copy the value.
It works well, but it’s a little bit a shame to make a request to the server just to get the JS to execute…

So by using a Lit-Element, I’m able to define everything I need (the textfield + the button with the clickListener) but unfortunately everything will be wrapped into this new custom element (let’s call it “copiable-text-field”).

...

Is there any way to directly extends the vaadin-text-field to avoid a wrapper ?

Thanks you :slightly_smiling_face:

I would keep the Java solution

Sure, it works. I was just wondering if it was doable :wink:

It’s the same with typescript “YourField extends TextField”

where a static “is” method would return “your-field”

but what will be the content of template then?

ok I think I got it, thanks :slightly_smiling_face: