@yogthos I am not sure if you mean the vrac components or the html nodes in the form.
For the components, they are not themself visible or disabled. The only choice for them is to be included or not being included in the view at any time.
For the html nodes, visible and disabled would be attributes to set in the same way of the value
attribute on the input html node.
ah ok yeah I was referring to html nodes, and doing it the same way as value makes sense
you would need to differentiate between static and dynamic nodes somehow potentially
cause some parts of the template can be rendered once if they have no behaviors, but others will need to observe the state and repaint if the state changes
(defc numeric [title data]
(let [form-id (gen-id "form-")] ;; non-reactive binding to a generated unique string
[:div
[:label {:for form-id} title]
[:input {:type :number
:id form-id
:value (:value data)
:disabled (:disabled? data)
:style {:visibility (if (:visible? data) "visible" "hidden")}
:on-change (dispatch [:input-change data])}]]))
ok yeah that's exactly what I was thinking
(if (:visible? data) "visible" "hidden")
is a little special, it’s not the same if
than the one that returns html nodes. It’s a if
which returns values, as if it was wrapped into a (val ...)
block.