material_file: Create a materialize file input

Description Usage Arguments Examples

Description

Build a materialize file input.

Usage

1
2
3
4
5
material_file(inputId, label, server = FALSE, multiple = FALSE,
  icon = "file_upload", class = NULL, depth = NULL, color = NULL)

update_material_file(input, inputId, rootDirectory,
  session = shiny::getDefaultReactiveDomain())

Arguments

inputId

String. The input identifier used to access the value.

label

String. The file input button text.

server

Logical. Should the file be selected on server-side rather than client-side?

multiple

logical. Should select multiples files?

icon

String. The name of the icon. Leave empty for no icon. Visit http://materializecss.com/icons.html for a list of available icons.

class

String. Aditional class for button. Value should be 'btn-round', 'btn-large' or 'btn-small'.

depth

Integer. The amount of depth of the button. The value should be between 0 and 5. Leave empty for the default depth.

color

String. The color name of the fileinput. Leave empty for the 'teal lighten-1' color. Visit http://materializecss.com/color.html for a list of available colors.

input

Shiny server input.

rootDirectory

String. The begin directory to browser. Read-only access needed.

session

Shiny default reactive domain.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (interactive()) {
library(shiny)
library(materializer)
# Wrap materialize apps in material_page
ui <- material_body(
  title = "Basic Page",
  include_fonts = TRUE,
  tags$h1("Page Content"),
  material_file(inputId = "example_file_input", label = "ok")
)

server <- function(input, output, session) {

  observeEvent(input$example_file_input, {
    inFile <- input$example_file_input
    if (is.null(inFile)) {
      return(NULL)
    }
    x <- read.csv(inFile$datapath)
    message(head(x))
  })
}
shinyApp(ui = ui, server = server)
}

TuSKan/materializer documentation built on May 17, 2019, 6:35 p.m.