This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-18
Channels
- # announcements (2)
- # babashka (65)
- # beginners (104)
- # boot (8)
- # calva (23)
- # circleci (3)
- # clj-commons (1)
- # clj-on-windows (3)
- # clojure (43)
- # clojure-europe (45)
- # clojure-france (2)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-norway (13)
- # clojure-uk (4)
- # clojurescript (5)
- # core-typed (2)
- # cursive (5)
- # data-science (2)
- # datalevin (10)
- # emacs (38)
- # events (2)
- # fulcro (11)
- # graphql (6)
- # gratitude (2)
- # helix (11)
- # hugsql (3)
- # jobs (2)
- # lsp (17)
- # luminus (1)
- # malli (15)
- # missionary (3)
- # nrepl (6)
- # off-topic (6)
- # pedestal (2)
- # portal (16)
- # reagent (33)
- # reitit (4)
- # releases (12)
- # ring (2)
- # sci (3)
- # shadow-cljs (21)
- # spacemacs (7)
- # sql (5)
- # tools-build (36)
- # web-security (2)
Hi, I’m trying to get headlessui working in my app using Helix.
(ns website.core
(:require [helix.core :refer [defnc $ <>]]
[helix.dom :as d]
["react-dom" :as rdom]
["@headlessui/react" :refer [Switch]]))
(def switch-label #(. Switch -Label))
(def switch-group #(. Switch -Group))
(defnc my-component []
(switch-group
(switch-label "Dooo")
(Switch {:checked true
:class "relative inline-flex items-center h-6 rounded-full w-11 bg-gray-200"})))
(defn ^:export start
[]
(rdom/render ($ my-component) (js/document.getElementById "app")))
I know my Switch
is missing a bunch of props but its getting switch-group
and switch-label
to play nicely.
So I guess my question comes down to this, how does one go about using a lib such as HeadlessUI
in Helix?
Using
(def switch-label (. Switch -Label))
(def switch-group (. Switch -Group))
(defnc my-component []
(switch-group
(switch-label "Foo")
(Switch {:checked true
:class "relative inline-flex items-center h-6 rounded-full w-11 bg-gray-200"})))
Results in this error
I’m idiot… ignore me. Just in case any one ever stumbles on this
(ns website.core
(:require [helix.core :refer [defnc $ <>]]
[helix.dom :as d]
["react-dom" :as rdom]
["@headlessui/react" :as ui]))
(def switch-label ui/Switch.Label)
(def switch-group ui/Switch.Group)
(defnc my-component []
($ switch-group
($ switch-label "Hello?")
($ ui/Switch {:checked true
:className "relative inline-flex items-center h-6 rounded-full w-11 bg-gray-200"})))
👏 4
1
That works