clerk

Zach 2025-04-13T01:04:54.859939Z

I remember seeing a while ago that clerk isn't going to go in the direction of having interactive forms in the notebook. I have a flow that I'd like to be highly interactive and connected to my repl. A basic example is having a graph and a dropdown. When the dropdown is interacted with the graph gets updated and some state in my repl gets updated to capture the state of the dropdown. 1. Am I wrong and this is something that's supported in clerk? 2. If it's not possible, does any tooling like this exist? 3. If no tooling already exists, could anyone suggest some projects I could use to build this?

Felipe 2025-04-30T18:11:09.796999Z

I recently used Clerk Sync to change the notebook state based on a dropdown and it works great!

Felipe 2025-04-30T18:16:30.259659Z

here's a slightly modified snippet:

^{::clerk/sync true, ::clerk/visibility {:code :show :result :hide}}
(def *client (atom :a-client))

^{::clerk/visibility {:code :hide :result :show}}
  (clerk/with-viewer
    {:transform-fn clerk/mark-presented
     :render-fn
     '(fn [coll]
        [:form
         [:select.w-full.rounded-lg.border.border-gray-300.bg-gray-50.px-2.text-gray-700.hover:border-cyan-500.hover:bg-white.dark:border-gray-600.dark:bg-gray-800.dark:text-gray-200.dark:hover:border-cyan-700.dark:hover:bg-gray-700.forced-colors:appearance-auto
          {:on-change (fn [e] (reset! *client (keyword (.-value (.-target e)))))
           :defaultValue @*client}
          (into [:<>]
                (for [item coll]
                  [:option {:value (name item)} (name item)]))]])}
    (keys @clients/*client->details))

mkvlr 2025-04-13T07:26:47.030039Z

you can build interactive things on top of clerk sync https://book.clerk.vision/#clerk-sync

❤️ 3
mkvlr 2025-04-13T07:27:11.217949Z

clerks Tap Inspector is also built this way