Is there a way to remove text field from fileInput in shiny?
This is how it currently is:
and this is how I want it to be:
One can define a custom input function, that takes the regular one and cuts away the pieces you don't want.
library(shiny)
fileInputOnlyButton <- function(..., label="") {
temp <- fileInput(..., label=label)
# Cut away the label
temp$children[[1]] <- NULL
# Cut away the input field (after label is cut, this is position 1 now)
temp$children[[1]]$children[[2]] <- NULL
# Remove input group classes (makes button flat on one side)
temp$children[[1]]$attribs$class <- NULL
temp$children[[1]]$children[[1]]$attribs$class <- NULL
temp
}
ui <- shinyUI(fluidPage(
# Set width to fit the upload progress bar to button size.
fileInputOnlyButton("file", buttonLabel="Browse", width=72)
))
server <- shinyServer(function(input, output) {})
shinyApp(ui, server)