R shiny pickerinput choicesOpt

1.2k views Asked by At

This is a simple question: I'm having a hard time finding a documentation of what can go into the choicesOpt argument of pickerInput. I've tried Google, Stackoverflow and most of the doc-sites I know and tried looking in the source of the package yet haven't found anything. Could someone point me in the right direction?

2

There are 2 answers

1
Pork Chop On

Select picker Input Control, i.e. the pickerInput is built on top of bootstrap-select, documentation for all the options is here

0
Ronak Shah On

choicesOpt argument is useful to apply formatting to the inputs of pickerInput.

For example to give background to the options of pickerInput you can do :

library(shiny)
cols <- c('blue', 'green', 'red', 'yellow')
ui <- fluidPage(
  pickerInput("col", "Colour", choices = cols, 
              choicesOpt = list(style = sprintf('background:%s;', cols)))
)

server <- function(input, output){}

shinyApp(ui, server)

enter image description here