Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(page "radio.html")
(defn radio [out-cell vals-labels]
(let [name (gensym "radio")]
(div
(for-tpl [[val label] vals-labels]
(span
(input {:type "radio"
:name name
:change #(reset! out-cell @%)
:value val})
label
(br))))))
(html
(head
(link :href "app.css" :rel "stylesheet" :type "text/css"))
(body
(h1 "Hello, Hoplon!")
(let [sex (cell nil)]
(div
(radio sex
[["male" "Male"]
["female" "Female"]])
(p (text "Sex: ~{sex}"))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment