rshinyshinydashboardpickerinput

(AD) Remove "Select All" action button from pickerInput using shinywidgets


Continuing the discussion mentioned here:

Remove "Select All" action button from pickerInput using shinywidgets

OP had this code and tries to remove one of the select/deselect buttons:

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

The answer was to utilize CSS:

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

Where exactly should this part of the code be put so that the select-all button disappears?


Solution

  • Try this

    library(gapminder)
    
    my_css <- "
    .bs-select-all {
      display: none;
    }
    .bs-deselect-all {
      width: 100%;
    }
    "
    
    df <- gapminder
    country_list <- unique(df$country)
    
    ui <- fluidPage(
      tags$head(tags$style(HTML(my_css))),
      pickerInput(
        inputId = "country_list", 
        label = "Select countries", 
        choices = as.character(country_list), 
        multiple = TRUE, 
        options = pickerOptions(actionsBox = TRUE)
       
      )
    )
    
    server <- function(input, output) {}
    
    shinyApp(ui, server)