@Tag("my-custom-element")
public interface MyCustomElement extends HTMLElement {
@Property
String getName();
@Property
void setName(String name);
@Property
int getValue();
@Property
void setValue(int value);
@EventHandler
void onClick(ClickEvent event);
}
@Route("myapp")
public class MyApplication extends Div {
public MyApplication() {
MyCustomElement customElement = new MyCustomElement();
customElement.setName("Hello");
customElement.setValue(42);
customElement.addEventListener("click", e -> {
Notification.show("Element clicked!");
});
add(customElement);
}
}