KinoClipboard (kino_clipboard v0.1.0)

A component that allows you to copy text to the clipboard.

Summary

Functions

Callback implementation for Kino.JS.Live.handle_connect/1.

Callback implementation for Kino.JS.Live.init/2.

Creates a "Copy to clipboard" button.

Functions

handle_connect(ctx)

Callback implementation for Kino.JS.Live.handle_connect/1.

handle_event(binary, args, ctx)

Callback implementation for Kino.JS.Live.handle_event/3.

init(arg, ctx)

Callback implementation for Kino.JS.Live.init/2.

new(data_or_fun, opts \\ [])

@spec new(
  String.t() | (-> String.t()),
  keyword()
) :: Kino.JS.Live.t()

Creates a "Copy to clipboard" button.

Data to be copied can be provided as a string or as a function that returns a string.

Options

  • :label - The label of the button. Defaults to "Copy to clipboard".

Examples

KinoClipboard.new("Hello world!")

KinoClipboard.new(fn -> "Hello world!" end)

KinoClipboard.new(fn -> "Hello world!" end, label: "Copy to clipboard")