material_file_input {shinymaterial} | R Documentation |
Create a shinymaterial file input
Description
Build a shinymaterial file input.
Usage
material_file_input(input_id, label = "File", color = NULL)
Arguments
input_id |
String. The input identifier used to access the value. |
label |
String. The file input button text. |
color |
String. The color of the file input. Leave empty for the default color. Visit https://materializecss.com/color.html for a list of available colors. This input requires using color hex codes, rather than the word form. E.g., "#ef5350", rather than "red lighten-1". |
Examples
if (interactive()) {
ui <-
material_page(
material_row(
material_column(
width = 12,
material_file_input(
input_id = "file_1",
label = "file"
)
)
),
material_row(
material_column(
width = 12,
tableOutput("contents")
)
)
)
server <- function(input, output) {
output$contents <- renderTable({
# input$file_1 will be NULL initially. After the user selects
# and uploads a file, it will be a data frame with 'name',
# 'size', 'type', and 'datapath' columns. The 'datapath'
# column will contain the local filenames where the data can
# be found.
in_file <- input$file_1
if (is.null(in_file))
return(NULL)
read.csv(in_file$datapath)
})
}
shinyApp(ui, server)
}
[Package shinymaterial version 1.2.0 Index]