htmlshinylabelactionlinkselectinput

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


[Previous question]How to include an action link into a button's label?

How I can align "get help" on the right of 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)


Solution

  • as far as I understand from the problem is you want a helper icon or link on the side of you select input. you can use shinyhelper library for that.For Detailed Documentation yo can refer to here

    I tried a sample for using this: hope this help

    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)
    

    Output Looks like: enter image description here

    after clicking the icon: enter image description here