我的目标是在selectInput
按钮的标签中包含一个操作链接(显示帮助文本)。
library(shiny)
ui <- fluidPage(
br(),
selectInput(
inputId = "some_id",
label = "Please choose A or B (get help)",
choices = c("choice A", "choice B"),
selected = "choice A",
selectize = F
),
actionLink(inputId = "action_link", label = "get help")
) # fluidPage
server <- function(input, output) {}
shinyApp(ui, server)
我猜解决方案是使用label = HTML(...)
,但我不知道如何用纯HTML重写操作链接。
答案 0 :(得分:2)
selectInput(
inputId = "some_id",
label = HTML("Please choose A or B",
as.character(actionLink(inputId = 'action_link', label = 'get help'))),
choices = c("choice A", "choice B"),
selected = "choice A",
selectize = F
)
答案 1 :(得分:2)
您还可以使用tags
,例如a
和p
library(shiny)
ui <- fluidPage(
br(),
selectInput(
inputId = "some_id",
label = p("Please choose A or B ",a("get help", href = "https://www.google.com/", target = "_blank")),
choices = c("choice A", "choice B"),
selected = "choice A",
selectize = F
)
) # fluidPage
server <- function(input, output) {}
shinyApp(ui, server)