lambdaisland / ornament

Clojure Styled Components
Mozilla Public License 2.0
118 stars 13 forks source link

How to pass html attributes to styled component with render function? #17

Closed GetBitOutdoors closed 3 months ago

GetBitOutdoors commented 2 years ago

This should work for a single value.

(defstyled myelem :div
  ([html-attr-value]
   ^{:html-attr-key html-attr-value} ; attrs for outer html div
   [:<>
    [:h1 "Hello World"]]))

(myelem "val")
=> <div html-attr-key="val"><h1>Hello World</h1></div>

But how do you pass a map of html attr values to outer (parent div) html element (when render function is receiving input)?

plexus commented 2 years ago

Have a look at what we're doing in #13 . Does that solve your issue?