twFileInput | R Documentation |
shiny::fileInput()
but allowing for more classesWrapper around shiny::fileInput()
but allowing for more classes
twFileInput( inputId, label, multiple = FALSE, accept = NULL, width = NULL, buttonLabel = "Browse...", placeholder = "No file selected", container_class = NULL, label_class = NULL, select_class = NULL, button_class = NULL, progress_class = NULL )
inputId |
The |
label |
Display label for the control, or |
multiple |
Whether the user should be allowed to select and upload multiple files at once. Does not work on older browsers, including Internet Explorer 9 and earlier. |
accept |
A character vector of "unique file type specifiers" which gives the browser a hint as to the type of file the server expects. Many browsers use this prevent the user from selecting an invalid file. A unique file type specifier can be:
|
width |
The width of the input, e.g. |
buttonLabel |
The label used on the button. Can be text or an HTML tag object. |
placeholder |
The text to show before a file has been uploaded. |
container_class |
additional classes to be applied to the container |
label_class |
additional classes to be applied to the label |
select_class |
additional classes to be applied to the select elements |
button_class |
additional classes to be applied to the upload button |
progress_class |
additional classes to be applied to the progress bar (ie color) |
a list with a shiny.tag
class
shiny::fileInput()
shiny::fileInput("id", "label", multiple = TRUE, accept = c(".csv", ".rds"), width = "200px", buttonLabel = "Upload", placeholder = "Here" ) twFileInput("id", "label", multiple = TRUE, accept = c(".csv", ".rds"), width = "200px", buttonLabel = "Upload", placeholder = "Here", container_class = "CONTAINER", label_class = "LABEL", select_class = "SELECT" ) # basic full shiny example library(shiny) ui <- fluidPage( use_tailwind(), twFileInput( inputId = "file", label = "Upload", multiple = TRUE, buttonLabel = "Upload", placeholder = "Nothing selected", container_class = "shadow-md rounded-md bg-gray-50 m-2 p-2 w-96", label_class = "font-serif text-red-800", select_class = "font-mono font-bold text-red-800 rounded-r-lg", button_class = paste( "bg-red-800 border-red-800 hover:bg-red-700", "hover:border-red-700 text-white hover:text-gray-50" ), progress_class = "bg-red-800" ), verbatimTextOutput("data") ) server <- function(input, output) { output$data <- renderText({ paste(capture.output(str(input$file)), collapse = "\n") }) } if (interactive()) shiny::shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.