Ok, the penny dropped. It seems that selectize doesn't work like I thought it should. I thought it was a box of options that you could select and deselect, and the selected ones would be the highlighted ones, and you could toggle them on and off. Instead, to deselect you have to highlight one or more items in the box and then click the physical Delete button on the keyboard! (no idea how to do it on a phone) at which point those items return to the ugly drop-down list.
It seems there is a "remove button" plugin that makes it work a bit more like I thought it should. However you still get the ugly drop down list of unselected choices, which obscures a lot of the screen:
https://gist.github.com/pvictor/ee154cc600e82f3ed2ce0a333bc7d015
library(shiny)
ui <- fluidPage(
uiOutput("selector"),
uiOutput("displayer")
)
server <- function(input, output, session){
output$selector <- renderUI({
# selectInput("mychoice", label="Choose some:", choices=c("One", "Two", "Three"), selected=c("One", "Two", "Three"), multiple=TRUE, selectize=FALSE)
selectizeInput("mychoice", label="Choose some:", choices=c("One", "Two", "Three"), selected=c("One", "Two", "Three"), multiple=TRUE,
options=list(plugins=list("remove_button"), create=TRUE, persist=FALSE))
})
output$displayer <- renderText({
paste(input$mychoice)
})
}
shinyApp(ui, server)