如何右对齐 selectInput 标签上的 actionLink 标签

How to right align label of actionLink which on label of selectInput

[上一题]

如何将 "get help" 对齐到 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)

据我所知,问题是您想要一个辅助图标或 link 在您 select 输入的旁边。 你可以使用 shinyhelper 库 that.For 详细文档你可以参考 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)

输出看起来像:

点击图标后: