Search code examples
rshinyshinywidgets

How can the icon of airDatepickerInput


enter image description here

How can I change this icon to something else, like a an icon that represents reset?


Solution

  • This button is actually an actionButton with inputId <ID>_button, so the easiest way to change the icon is to update button server-side:

    library(shiny)
    library(shinyWidgets)
    
    ui <- fluidPage(
      airDatepickerInput(
        inputId = "mydate",
        label = "Select a dates"
      ),
      verbatimTextOutput("res")
    )
    
    server <- function(input, output, session) {
      
      updateActionButton(session, "mydate_button", icon = icon("remove"))
      
      output$res <- renderPrint(input$mydate)
    }
    
    shinyApp(ui, server)