Skip to content

Commit

Permalink
Merge pull request #603 from elektronik2k5/patch-2
Browse files Browse the repository at this point in the history
Document creating non standard HTML attributes
  • Loading branch information
Deraen authored Jun 3, 2024
2 parents 0a8441c + 2e6acb6 commit 886d203
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/UsingHiccupToDescribeHTML.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ As described below, reagent provides a number of extensions and conveniences to
2. If the second element is a map, it represents the attributes to the element. The attribute map may be omitted.
3. Any additional elements must either be Hiccup vectors representing child nodes or string literals representing child text nodes.

### Creating non standard HTML attributes

While standard HTML attributes are passed as `:keywords`, if you need a non standard one, use a string key:

```clojure
[:span {"custom-attribute" "value"}]
```
Will result in:

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

## Special treatment of `nil` child nodes

Reagent and React ignore nil nodes, which allow conditional logic in Hiccup forms:
Expand Down

0 comments on commit 886d203

Please sign in to comment.