Create a token that can be dragged onto an (overlay plot)overlayPlotOutput()
to create a new overlay.
Details
Note that the DOM ID of the token will be converted to
"overshiny_token_<inputId>"
. 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).
See also
overlayServer()
, for a complete example.
Examples
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; }"))
)