A PartCallback which allows templates to set properties and declarative
event handlers.
Properties are set by default, instead of attributes. Attribute names in
lit-html templates preserve case, so properties are case sensitive. If an
expression takes up an entire attribute value, then the property is set to
that value. If an expression is interpolated with a string or other
expressions then the property is set to the string result of the
interpolation.
To set an attribute instead of a property, append a $ suffix to the
attribute name.
Example:
html`<button class$="primary">Buy Now</button>`
To set an event handler, prefix the attribute name with on-:
A PartCallback which allows templates to set properties and declarative event handlers.
Properties are set by default, instead of attributes. Attribute names in lit-html templates preserve case, so properties are case sensitive. If an expression takes up an entire attribute value, then the property is set to that value. If an expression is interpolated with a string or other expressions then the property is set to the string result of the interpolation.
To set an attribute instead of a property, append a
$suffix to the attribute name.Example:
html`<button class$="primary">Buy Now</button>`To set an event handler, prefix the attribute name with
on-:Example:
html`<button on-click=${(e)=> this.onClickHandler(e)}>Buy Now</button>`