@ID (lit element)

Hi,
I know and mainly use @id annotation with lit.

I have a need for some dynamic field injections.

Say I have text field with id abc
How can I inject using code not @ID ?

If you case is that you want to add a TextField instantiated in Java to your template, you need to add a slot in your template as a placeholder for it

And in Java do

TextField field = new TextField();
field.getElement().setAttribute(“slot”, “field”);
template.getElement().appendChild(field.getElement());

Hi, Thank you, but didn’t mean for slot. I was wondering how i can use @Id programmatically, not as annotation.

I am building “low-code” solution

If you wanna build something highly dynamic, I would suggest to use https://cookbook.vaadin.com/custom-layout