JohnCoene / tippy

💬 Tippy.js for Shiny
http://tippy.john-coene.com/
Other
77 stars 2 forks source link

Tippy and insertUI #22

Open bartekch opened 2 years ago

bartekch commented 2 years ago

I want to create an actionButton with tippy inside insertUI, unfortunately I can't get it working. I've tried the following approaches, without success.

library(shiny)
library(tippy)
shinyApp(
  ui = basicPage(
    actionButton("add", "Add ui")
  ),

  server = function(input, output) {
    observeEvent(input$add, {
      insertUI(
        "#add",
        "afterEnd",
        tagList(
          tippy::tippy(
            actionButton("button1", "tippy"),
            "Tooltip 1"
          ),
          actionButton("button2", "tippyThis"),
          tippy::tippyThis("button2", "Tooltip 2")
        )
      )
    })
  }
)

This was tested with version 1.0.0.

In CRAN version 0.0.1 both approaches (their corresponsing versions) seem to work.

library(shiny)
library(tippy)
shinyApp(
  ui = basicPage(
    actionButton("add", "Add ui")
  ),

  server = function(input, output) {
    observeEvent(input$add, {
      insertUI(
        "#add",
        "afterEnd",
        tagList(
          tippy::with_tippy(
            actionButton("button1", "with_tippy working"),
            "Tooltip 1"
          ),
          actionButton("button2", "tippy_this not working"),
          tippy::tippy_this("button2", "Tooltip 2")
        )
      )
    })
  }
)

Is it possible to add tooltips to elements created by insertUI using tippy 1.0.0?