【问题标题】:How to right align label of actionLink which on label of selectInput如何右对齐 selectInput 标签上的 actionLink 标签
【发布时间】:2020-03-03 06:47:54
【问题描述】:

[上一个问题]How to include an action link into a button's label?

如何在 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)

【问题讨论】:

    标签: html shiny label actionlink selectinput


    【解决方案1】:

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

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

    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)
    

    输出看起来像:

    点击图标后:

    【讨论】:

      猜你喜欢
      • 2012-08-26
      • 1970-01-01
      • 1970-01-01
      • 2017-11-28
      • 2010-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多