Skip to content

labelRenderer property in virtualSearchInput? #601

@moturoa

Description

@moturoa

In this example we see the use of the labelRenderer option. I was wondering if you know whether it can be used from virtualSelectInput, as the option should be passed through ...

Non-working example with selectizeInput for reference:

library(shiny)
chcs <- rownames(mtcars)

ui <- fluidPage(theme = bslib::bs_theme(version = 5),

  shinyWidgets::virtualSelectInput("sel1", "Select car (virtual select)",
                             choices = chcs,
                             labelRenderer = I('function(data){
                                                  return "<span style = \'font-size: 3em;\'>" + data.label + "</span>";
                                                }')
                             ),
  
  selectizeInput("sel2", "Select car (selectinput)", choices = chcs,
              options = list(
                render = I('{
                              item: function(data){
                                    return "<span style = \'color:red;\'>" + data.label + "</span>";
                              },
                              option: function(data){
                                    return "<div style = \'color: blue;\'>" + data.label + "</div>";
                              }
                           }
                           ')
              )
              )
)
server <- function(input, output, session) {}
shinyApp(ui, server)

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions