我希望在小部件标题旁边添加一个(?),这样用户就可以悬停或单击它以获取额外信息和可点击的链接。
目前我的代码如下:
目前我的代码如下:
## app.R ##
library(shiny)
library(shinydashboard)
library(shinyBS)
# Header
header <- dashboardHeader()
# Sidebar
sidebar <- dashboardSidebar(fileInput("chosenfile", label = h4("File input"),
accept = ".csv"),
bsButton("q1", label = "", icon = icon("question"),
style = "info", size = "extra-small"),
bsPopover(id = "q1", title = "Tidy data",
content = paste0("You should read the ",
a("tidy data paper",
href = "http://vita.had.co.nz/papers/tidy-data.pdf",
target="_blank")),
placement = "right",
trigger = "click",
options = list(container = "body")
)
)
# Body
body <- dashboardBody()
# ui
ui <- dashboardPage(header, sidebar, body)
# server
server <- function(input, output) {
}
# run
shinyApp(ui, server)
但它还远远不完美。例如,(?)的位置不在“文件输入”旁边,关闭弹出框需要再次点击问号,而不是在弹出框中有个(x)。
h4
。这个问题可能会有所帮助(最后一篇帖子):https://github.com/ebailey78/shinyBS/issues/26 - Gopala