Generates shiny input form input based on a JSON schema structured list. Wraps react-jsonschema-form.
library(shiny)
library(shinyjsonschemaform)
schema <- list(
title = 'My Form',
type = 'object',
properties = list(
name = list(
title = 'Name',
type = 'string',
default = 'Jo'
),
age = list(
title = 'Age',
type = 'integer',
default = 42
)
)
)
ui <- fluidPage(
titlePanel("Simple Form"),
jsonSchemaFormInput(
"simpleForm",
schema = schema
),
verbatimTextOutput('result')
)
server <- function(input, output, session) {
output$result <- renderText({
paste(
input$simpleForm$name,
input$simpleForm$age,
sep = '\n'
)
})
}
shinyApp(ui, server)
This package is not yet on CRAN. Install from github:
devtools::install_github('katrinabrock/shinyjsonschemaform', subdir = 'srcR')