Attributes
Overview
HTML element methods, eg. #h1
, #meta
, #div
, etc, accepts a NamedTuple as
parameter, so it is possible to pass any attributes to an HTML element.
Attribute name conversion
Note that Blueprint parses all attributes name replacing _
by -
NamedTuple attributes
If you pass a NamedTuple attribute to some element attribute, it will be
flattened with a dash between each level. This is useful for data-*
and
aria-*
attributes.
Boolean attributes
If you pass true
to some attribute, it will be rendered as a boolean HTML
attribute, in other words, just the attribute name will be rendered without the
value. If you pass false
the attribute will not be rendered. If you want the
attribute value to be "true"
or "false"
, use true
and false
between
quotes.
Array attributes
If you pass an Array as attribute value, it will be flattened and joined using
" "
as separator.