overlayToken | R Documentation |
Create a token that can be dragged onto an overlay plot to create a new overlay.
overlayToken(id, name, label = name)
id |
A unique ID for the token (a character string without spaces). |
name |
Text (or HTML) to be displayed on the token itself. |
label |
Text label that will appear on the overlay. |
Note that the DOM ID of the token will be converted to
"overshiny_token_<id>"
. This transformed ID is important for internal
interaction logic (e.g. for use with JavaScript drag/drop handlers). When
referencing the token programmatically (e.g. in CSS selectors or custom
JavaScript), use the full prefixed ID (see examples).
An overlay token input control that can be added to a UI definition.
overlayServer()
, for a complete example.
ui <- shiny::fluidPage(
useOverlay(),
overlayToken("add", "Add new overlay", "Overlay"),
# The token's HTML id will be "overshiny_token_add"
shiny::tags$style(shiny::HTML("#overshiny_token_add { cursor: grab; }"))
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.