Skip to content

Commit

Permalink
docs(README): prefix custom property name with $
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Oct 2, 2022
1 parent da6d8ed commit 0b22507
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,17 @@ rendered as:
```

## Apply class names based on properties
If the custom property name isn't the part of the element, you must prefix it with `$` to prevent it from being reflected to the element's attribute or getting type errors.
```jsx
const Button = el.button`
inline-flex
font:14
${({color}) => color && `font:white bg:${color}`)}
${({$color}) => $color && `font:white bg:${$color}`)}
`

return (
<Button color="blue">...</Button>
<Button color="red">...</Button>
<Button $color="blue">...</Button>
<Button $color="red">...</Button>
<Button disabled>...</Button>
)
```
Expand Down

0 comments on commit 0b22507

Please sign in to comment.