首页 > 解决方案 > 如何将操作链接包含到按钮的标签中?

问题描述

我的目标是在按钮的标签中包含一个操作链接(显示帮助文本)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 重写操作链接。

标签: rshiny

解决方案


  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
  )

推荐阅读