0

Space for each choice in a dropdown menu is limited. We might want to use a shorter title for each of these choices to limit the size of the dropdown, but let to the user the ability to hover on each choice to see on screen the definition of each choice. Here is a very basic pickerInput setup where title would be the expected printed value on hover.

library(shiny)
library(shinyWidgets)

choices <- list("A" = 1, "B" = 2, "C" = 3)
title <- list("A" = "First option", "B" = "Second option", "C" = "Third option")

shinyApp(
  ui = fluidPage(
    pickerInput(inputId = "pick", label = "Test picker", 
                choices = choices, selected = 1),
    textOutput(outputId = "out")
  ),
  server = function(input, output, session) {
    output$out <- renderText({
      input$pick
    })
  }
)

Here is an image of the expected output. I added it through the web inspector as a CSS title argument of the a tag of each choice.

enter image description here

enter image description here

How could we add these title arguments for each of the choice? I went through all the possible pickerOptions of the shinyWidgets library, but it can not be found there. Maybe a JS option is the last possible resort?

bdbmax
  • 341
  • 6

0 Answers0