Kino (Kino v0.1.2) View Source

Client-driven interactive widgets for Livebook.

Kino is the library used by Livebook to render rich and interactive output directly from your Elixir code.

Kino renders any data structure that implements the Kino.Render protocol, falling back to the inspect/2 representation whenever an implementation is not available. The data structures supported by Kino out of the box are:

VegaLite widgets

VegaLite specifications are rendered as visualizations:

Vl.new(...)
|> Vl.data_from_series(...)
|> ...

Kino.VegaLite widgets

Kino.VegaLite is an extension of VegaLite that allows data to be streamed:

widget =
  Vl.new(...)
  |> Vl.data_from_series(...)
  |> ...
  |> Kino.VegaLite.start()
  |> Kino.render()

Kino.VegaLite.push(widget, %{x: 1, y: 2})

Kino.ETS widgets

Kino.ETS implements a data table output for ETS tables in the system:

tid = :ets.new(:users, [:set, :public])
Kino.ETS.start(tid)

All others

All other data structures are rendered as text using Elixir's inspect/2.

Link to this section Summary

Functions

Sends the given term as cell output.

Link to this section Functions

Specs

render(term()) :: term()

Sends the given term as cell output.

This allows any Livebook cell to have multiple evaluation results. You can think of this function as a generalized IO.puts/2 that works for any type.