simpleui tutorial examples full docs source motivation simpleui within Clojure youtube

Dialogs

Dialogs can be triggered with the hx-prompt and hx-confirm attributes. These are triggered by the user interaction that would trigger the AJAX request, but the request is only sent if the dialog is accepted.


(defcomponent ^:endpoint reply [{:keys [headers]}]
  [:div#response.mmargin "You entered " (headers "hx-prompt")])

(def ring-handler
  (fn [req]
    ;; page renders initial html
    (page
      reply
      [:div
        [:button.btn.mb
          {:hx-post "reply"
           :hx-prompt "Enter a string"
           :hx-confirm "Are you sure?"
           :hx-target "#response"}
          "Prompt Submission"]
        [:div#response]])))