4

I am using shinywidgets pickerinput to create a dropdown for the user to select their country or countries of interest with the code below. I would like to remove the ability to “Select All” i.e. the user should only be able to select a few countries not the entire list (which is 185 countries).

I would like “Deselect All” to remain in case a new country comparison is required but selecting all the countries will not work in further downstream code.

Is it possible to remove this "Select All" functionality from pickerinput or perhaps an alternative solution that allow multiple selection with the ability to deselect all.

pickerInput(inputId = "country_select_list", label = "Select countries", choices = country_list, multiple = TRUE, options = pickerOptions(actionsBox = TRUE))

enter image description here

Aveshen Pillay
  • 431
  • 3
  • 13
  • `shinyWidgets` is open source, you can customize the widgets as you wish, using the source code of the function: https://github.com/dreamRs/shinyWidgets/blob/master/R/input-selectpicker.R – Jrm_FRL Apr 25 '20 at 13:06

1 Answers1

3

Due to limitations of the bootstrap-select - the library on which the pickerInput is based, there is no way to hide the Select All button using pickerInput's params.

But you can do it with CSS:

.bs-select-all {
  display: none;
}

After doing that, you might want to stretch the Deselect All button:

.bs-deselect-all {
  width: 100%;
}
MrLoon
  • 831
  • 1
  • 8
  • 16