ornament icon indicating copy to clipboard operation
ornament copied to clipboard

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

Open GetBitOutdoors opened this issue 3 years ago • 1 comments

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)?

GetBitOutdoors avatar Jun 06 '22 19:06 GetBitOutdoors

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

plexus avatar Aug 10 '22 11:08 plexus