I've just started using R-Shiny. But I have some of troubles using js and html code in Shiny.
In my app I have two bsButton
which when hover show some text with bsPopover
. One of these popover contains an image which is larger than the standard box of the popover and I'd like to set the width of this popover that fully contains the figure.
Here I found how to set the width and height of all popovers, but how can I set the width/height of only a specific popover?
This is my code so far and I'd like to change the width of bsPopover(id="q2", ...)
but not the width of bsPopover(id="q1", ...)
:
library(shiny)
library(shinyBS)
ui <- fluidPage(
tags$head(
# this changes the size of the popovers
tags$style(".popover{width:200px;height:250px;}")
),
fluidRow(
fileInput("file", label=h4("Upload Data",
tags$style(type = "text/css", "#q1 {vertical-align: top;}"),
bsButton("q1", label="", icon=icon("question"), style="info", size="extra-small")),
accept=".txt"
),
bsPopover(id="q1", title="Title help text1",
content=paste("help text"),
placement = "right",
trigger = "hover",
options = list(container = "body")
),
numericInput("numIn", label = h4("Choose a value",
tags$style(type="text/css", "#q2 {vertical-align: top;}"),
bsButton("q2", label="", icon=icon("question"), style="info", size="extra-small")),
value = 2.5, step=0.5),
bsPopover(id="q2", title="Title help text 2",
content=paste0("The figure below shows",
img(src='scenarios.png', align = "center", height="320px", width="800px", style="display:block;margin-top:20px;margin-left:auto;margin-right:auto;")
),
placement = "right",
trigger = "hover",
options = list(container = "body")
)
)
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)