Demos /

DynamicCardModule

Working framework components, paired with the Java that composes them.

DynamicCardModule

Submit a value to rebuild this request-owned dynamic card.

Dynamic card

Request value
Compose, Render
Java composition
String value = "Compose, Render";
Component module = DynamicCardModule.create().withTitle("Dynamic card").withCardContent("Request value", value);
new Div().withChild(Form.create().withAction("/demos/api/dynamic").withMethod(Form.Method.POST)
    .withHxPost("/demos/api/dynamic").withHxTarget("#dynamic-result").withHxSwap("outerHTML")
    .withChild(new HtmlTag("input", true).withAttribute("type", "hidden")
        .withAttribute("name", "kind").withAttribute("value", "dynamic-card"))
    .addField("Value", TextInput.create("value").withValue(value).required())
    .withChild(Button.submit("Update dynamic-card")))
    .withChild(new Div().withId("dynamic-result").withAttribute("aria-live", "polite").withChild(module));
// POST /demos/api/dynamic selects the same module with the submitted value.