Search code examples
cssrshinyplaceholdershinywidgets

picketInput change placeholder R Shiny Widgets


pickerInput from shinyWidgets package has a placeholder title Nothing selected.

How is it possible to replace it with Pick a choice for example ? I would prefer a solution that uses css or the options of pickerInput, if possible avoid shinyjs.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(

  tags$head(
    tags$style(HTML("

    "))
  ),

  pickerInput(
    inputId = "mtcInputIndicateur", 
    label = "Select values", 
    choices = paste("choice", 1:10),
    options = list(`live-search` = TRUE),
    multiple = TRUE
  )
)



server <- function(input, output){
}

shinyApp(ui, server)

Any help would be greatly appreciated.


Solution

  • Just found the answer, use the parameter title in options.

    library(shiny)
    library(shinyWidgets)
    
    ui <- fluidPage(
    
      pickerInput(
        inputId = "mtcInputIndicateur", 
        label = "Select values", 
        choices = paste("choice", 1:10),
        options = list(`live-search` = TRUE, title = "Pick a choice"),
        multiple = TRUE
      )
    )
    
    
    
    server <- function(input, output){
    }
    
    shinyApp(ui, server)