Search code examples
rshinyshiny-server

Adding/removing icon in downloadButton() and fileInput()


In Shiny, we have downloadButton() and fileInput() buttons for downloading and uploading data respectively.

However it happens that, with downloadButton() there is download icon, and however with fileInput() no icon is attached.

In my Shiny app, I have both buttons. However since one of them has icon attached, it brings some kind of visual inconsistency in my App.

So, I either want to remove such icon from downloadButton(), or add some upload button with fileInput() to bring consistency.

However, it appears that there is not any direct approach to perform either of them.

So can anybody suggest here if there is any way to :

Either remove icon from downloadButton() Or, attach some upload icon with fileInput()

Any pointer is highly appreciated.

Thanks,


Solution

  • To add an icon to fileInput(), add a list to the buttonLabel. e.g.

    shinyApp(
      fluidPage(
        fileInput("myFileInput",label="Test",buttonLabel=list(icon("folder"),"TestyMcTestFace"))
      ),
      function(input, output, session){
      }
    )