RxT
RxT

Reputation: 546

What should I do to write in a selectInput() in Shiny?

I did a selectInput() in Shiny, like this:

              box(selectInput("reg_cnae", "Por Região:", 
                              c("Todas",str_sort(unique(as.character(Coop_ativas$regiao)))),
                              selected = "Todos")),

But, in this selection, I have 27 options. How can I configure it, so I can write and it gives me the item? Instead of I need to scroll down by all items.

Upvotes: 2

Views: 900

Answers (1)

zimia
zimia

Reputation: 932

If you click inside the selectInput, then hit backspace, you should be able to type for the choice rather than looking through the dropdown. The other option would be to use a selectizeInput with a null inital value and a placeholder.

selectizeInput("reg_cnae", "Por Região:", 
               choices = c("Todas",str_sort(unique(as.character(Coop_ativas$regiao)))), 
               options = list(
                 placeholder = 'Type here',
                 onInitialize = I('function() { this.setValue(""); }')
               ))

Upvotes: 4

Related Questions