Learn R Programming

overshiny (version 0.1.0)

overlayToken: Create an overlay token input control

Description

Create a token that can be dragged onto an (overlay plot)overlayPlotOutput() to create a new overlay.

Usage

overlayToken(inputId, name, label = name)

Value

An overlay token input control that can be added to a UI definition.

Arguments

inputId

The input slot used for the token.

name

Text (or HTML) to be displayed on the token itself.

label

Text label that will appear on the 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

Run this code
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; }"))
)

Run the code above in your browser using DataLab