0

[上一个问题]如何在按钮标签中包含操作链接?

如何在 sidbarPanel 右侧对齐“获取帮助”?

library(shiny)

ui <- fluidPage(
  br(),
  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
  )
)


server <- function(input, output) {}

shinyApp(ui, server)

4

1 回答 1

0

据我了解,您希望在选择输入的一侧有一个帮助图标或链接。您可以为此使用 shinyhelper 库。有关详细文档,您可以参考这里

我尝试了一个示例来使用它:希望这有帮助

library(shiny)
library(shinyhelper)
library(magrittr)

ui <- fluidPage(

  titlePanel(title = "Demo APP"),

  sidebarLayout(

    sidebarPanel = sidebarPanel(

      selectInput(inputId = "dataset", "choose DataSet",
                  choices = c("MTCARS","IRSIS")
      ) %>% 
        helper(type = "inline",
               title = "Inline Help",
               content = c("This helpfile is defined entirely in the UI!",
                           "This is on a new line.",
                           "This is some <b>HTML</b>."),
               size = "s")
    ),

    mainPanel = mainPanel(
      verbatimTextOutput(outputId = "TABLE")

    )
  )
)


server <- function(input, output) {
  observe_helpers()
  output$TABLE<-renderText({

    paste0("Dataset selcted: ",input$dataset)

  }) 
}

shinyApp(ui, server)

输出看起来像: 在此处输入图像描述

点击图标后: 在此处输入图像描述

于 2019-11-07T06:32:35.513 回答