Search code examples
htmlreagenthiccup

What's the syntax to create a non standard HTML attribute in Reagent/Hiccup?


What's the syntax to create this HTML in Reagent/Hiccup?

<span custom-attribute="value"></span>

Reagent and Hiccup docs fail to mention it.

Standard attributes are added by using a {:keyword "value"} map, but only if :keyword is valid. I didn't find docs to add any arbitrary attribute.


Solution

  • [:span {"custom-attribute" "value"}]
    

    From Reagent's docs: https://github.com/reagent-project/reagent/blob/master/doc/UsingHiccupToDescribeHTML.md#creating-non-standard-html-attributes