How can I insert and display icons on a selectInput() choices?

Hello RStudio Community :wave:, I want to display icons on the choices of a selectInput(). Sadly, I haven't found out how to achieve this. I was wondering if somebody here has achieved this, thanks.

Here is a sample Shiny App with the idea (although it doesn't work as expected):


ui <- fluidPage(
    inputId = "si", 
    label = "Select Input:",
    choices = c(
      paste("item1", icon("gem")), 
  p("This is a Font Awesome icon (I want at the right side of 'item1'): ",  icon("crown"))

server <- function(input, output, session) {

shinyApp(ui, server)

The icon("gem") on the selectInput() just displays the raw html code <i class="fa fa-gem"></i>.

My result is this:

What I want is to include the icon as part of the choice on the select input, kinda like the next example:

Is this even possible in Shiny? Thanks.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.