@brightspace-ui-labs/s-html

2.2.0 • Public • Published

@brightspace-ui-labs/s-html

Element wrapper of .innerHTML for data binding with HTML elements.

Usage

Example 1

Localize text with HTML elements using app-localize-behavior.

locales.json

{
"text": "<a href=\"/settings\">Settings</a>"
}

HTML

<s-html html="[[localize('text')]]"></s-html>

Example 2

Using span element for content styled with CSS.

locales.json

{
"text": "<a class=\"red\" href=\"/settings\">Settings</a>"
}

CSS

.red {
  color: red;
}

HTML

<s-html html="[[localize('text')]]"><span></span></s-html>

Example 3

Unescape escaped HTML elements.

locales.json

{
"text": "polymer &lt;br&gt;"
}

HTML

<s-html unescape html="[[localize('text')]]"></s-html>

Installation

npm i @brightspace-ui-labs/s-html

License

MIT: StartPolymer/license

Versioning and Releasing

This repo is configured to use semantic-release. Commits prefixed with fix: and feat: will trigger patch and minor releases when merged to main.

To learn how to create major releases and release from maintenance branches, refer to the semantic-release GitHub Action documentation.

Package Sidebar

Install

npm i @brightspace-ui-labs/s-html

Weekly Downloads

534

Version

2.2.0

License

MIT

Unpacked Size

4.38 kB

Total Files

3

Last publish

Collaborators

  • d2l-travis-deploy
  • dlockhart
  • dave.batiste