Packages
kino
0.15.2
0.19.0
0.18.0
0.17.0
0.16.1
0.16.0
0.15.3
0.15.2
0.15.1
0.15.0
0.14.2
0.14.1
0.14.0
0.13.2
0.13.1
0.13.0
0.12.3
0.12.2
0.12.1
0.12.0
0.11.3
0.11.2
0.11.1
0.11.0
0.10.0
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.0
0.6.2
0.6.1
0.6.0
retired
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.3
0.2.2
0.2.1
0.2.0
0.1.3
0.1.2
0.1.1
0.1.0
Interactive widgets for Livebook
Current section
Files
Jump to
Current section
Files
lib/kino/html.ex
defmodule Kino.HTML do
@moduledoc ~S'''
A kino for rendering HTML content.
The HTML may include `<script>` tags with global JS to be executed.
In case you need to parameterize the HTML with dynamic values, write
a custom `Kino.JS` component.
## Examples
Kino.HTML.new("""
<h3>Look!</h3>
<p>I wrote this HTML from <strong>Kino</strong>!</p>
""")
Kino.HTML.new("""
<button id="button">Click</button>
<script>
const button = document.querySelector("#button");
button.addEventListener("click", (event) => {
button.textContent = "Clicked!"
});
</script>
""")
'''
use Kino.JS, assets_path: "lib/assets/html"
@type t :: Kino.JS.t()
@doc """
Creates a new kino displaying the given HTML.
"""
@spec new(String.t()) :: t()
def new(html) when is_binary(html) do
Kino.JS.new(__MODULE__, html)
end
end