Aveshen Pillay
Aveshen Pillay

Reputation: 481

Remove "Select All" action button from pickerInput using shinywidgets

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

Upvotes: 6

Views: 1292

Answers (1)

MrLoon
MrLoon

Reputation: 921

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%;
}

Upvotes: 4

Related Questions