I would like to know how I could set the title of a pickerInput()
to be displayed -"Please select a month"
- when values are selected by default.
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
pickerInput(
inputId = "month",
label = "Select a month",
choices = month.name,
selected = month.name,
multiple = TRUE,
options = pickerOptions(
actionsBox = TRUE,
title = "Please select a month",
header = "This is a title"
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
"Please select a month" will display in the picker itself but only at initial execution. Also at initial execution, all months are selected. When any event is observed for the picker, the picker itself will then show the selected values.
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
pickerInput(
inputId = "month",
label = "Select a month",
choices = month.name,
selected = month.name,
multiple = TRUE,
options = pickerOptions(
actionsBox = TRUE,
title = "Please select a month",
selectedTextFormat = 'static',
header = "This is a title"
)
)
)
server <- function(input, output, session) {
observeEvent(input$month, {
updatePickerInput(session = session, inputId = "month",options = pickerOptions(selectedTextFormat = 'values'))
}, ignoreInit = TRUE)
}
shinyApp(ui, server)