Genie Discord forum

Hello, when clicking on a button, a new visual element shall be added to the html file as well as the html structure is dependent on the structure of a julia object (the html file shall visually represent the object structure and allow for modification).
Is there a way to add visual elements programatically?

if you're ok with just hiding the element until you want to display it, you could use some inline css
where in the julia code you have @out displayvar = "none"

Also, in Genie Builder you can use the "condition" binding to set an element's visibility


Hello Pere, thanks for the quick reply! 🙂
Unfortunately, this doesn't fulfill my wishes. I have a julia object with a predefined structure, e.g.,
struct OverviewCard header::Header body::Body CTA::Maybe{Vector{AbstractButton}} id::String footer::Footer end
I want to represent this structure in the html. So for this example, for each element (header, body, footer, CTA), a div element shall be generated in the html. Furthermore, the CTA div includes again as many divs as the vector of AbstractButtons include. Is this possible with Genie Builder? How can I implement this?

best approach would be to generate the HTML content dynamically - do you have an example of an OverviewCard with data?

You should use @recur
for a series of elements and define a template.
You could get some inspiration in the editable tree demo https://github.com/GenieFramework/StippleDemos/blob/master/ReactiveTools%20API/EditableTree.jl or in the chatmessage demo of the chatmessage PR https://github.com/GenieFramework/StippleUI.jl/pull/87#issuecomment-1415519757