ijlyttle / bsplus

Shiny and R Markdown addons to Bootstrap 3
http://ijlyttle.github.io/bsplus/
Other
147 stars 23 forks source link

Different tooltip behavior with htmlOutput()/renderUI() #110

Open john-harrold opened 1 year ago

john-harrold commented 1 year ago

In the example below I'm creating two selection boxes. One by putting selectInput() in the ui and another by creating it in the server using htmlOutput()/renderUI(). For me the formatting of the tooltip is different. Is there a way to get the selection generated in the server to behave like that generated in the ui?

Server generated tooltip:

image

UI generated tooltip:

image
library(shiny)
library(bsplus)

ui <- fluidPage(
  use_bs_tooltip(),
  use_bs_popover(),

  titlePanel("Hello Shiny!"),
  sidebarLayout(
    sidebarPanel(
      htmlOutput("serverstuff"),
      selectInput(inputId ="myid_inui",
                  label = "list",
                  choices = c("a", "b", "c", "d"),
                  selected = "a") %>%
        bs_embed_tooltip(title =  "in UI",
                         trigger = "hover")
    ),
    mainPanel(
    )
  )
)
server <- function(input, output) {

  output$serverstuff = renderUI({

    ui_pipe =
      selectInput(inputId ="myid_inserver",
                  label = "list",
                  choices = c("a", "b", "c", "d"),
                  selected = "a") %>%
        bs_embed_tooltip(title =  "htmlOutput()/renderUI()",
                         trigger = "hover")

  ui_pipe})
}
shinyApp(ui, server)