我想在小部件标题旁边添加一个(?),以便用户可以悬停或单击它并获取额外信息和他们可以单击的链接。
这就是我现在所拥有的:
## 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)。