Module Byo_clipboard.With_status

With_status variants of all the copy functions. These return whether a copy was recently performed so UI components can display a status indicator.

type t = [
  1. | `Idle of unit Bonsai_web.Effect.t
  2. | `Copied
]

An effect that copies the given text to the clipboard.

An effect that copies the given text as text/html to the clipboard.

An effect that copies a link to the clipboard using both text/html (<a> tag) and text/plain MIME types. This provides rich formatting where supported with plain text fallback.

val copy_text_factory : Bonsai_web.Bonsai.graph @ local -> (?key:string -> string -> t) Bonsai_web.Bonsai.t

Creates a copy_text factory for use in environments where it would otherwise be awkward or impossible to thread graph around.

By default, the text-to-copy is used as the indentifier for the status. The optional key parameter allows distinguishing between multiple copy buttons that have the same text.