Last updated
Last updated
Consider this variable declaration:
This syntax is called “Brackethtml” it reduces the redundancy of HTML and still can be easily understood as HTML, in addition to supporting HTML normally.
Brackethtml already comes with a built-in CSS-in-JS library. In the previous examples, if we wanted to add some style to our button we could do:
The list below describes the usage rules:
The HTML tag name must be followed by square brackets:
The ~
symbol must be used inside tags that may contain children to separate attributes and CSS-in-JS from their children, and must be used between whitespace:
Tag attributes must always come before CSS-in-JS and use only double quotes "
:
CSS-in-JS must only use single quotes '
:
Some characters should be escaped to be used without Brackethtml interpreting them: ~
, [
, ]
, #
, @
, and $
.
To escape them just wrap them in parentheses (
)
: