Creates a teal_modules object.
modules.Rd
This function collects a list of
teal_modules and teal_module objects and returns a teal_modules object
containing the passed objects.
This function dictates what modules are included in a teal application. The internal structure of teal_modules
shapes the navigation panel of a teal application.
Arguments
- ...
parameters passed to
toString- label
(
character(1)) label of modules collection (default"root"). If using thelabelargument then it must be explicitly named. For examplemodules("lab", ...)should be converted tomodules(label = "lab", ...)- x
teal_modules- indent
(
integer) indent level; each submodule is indented one level more
Value
object of class teal_modules. Object contains following fields
label: taken from thelabelargumentchildren: a list containing objects passed in.... List elements are named after theirlabelattribute converted to a validshinyid.
(character)
Examples
library(shiny)
app <- init(
data = teal_data(dataset("iris", iris)),
modules = modules(
label = "Modules",
modules(
label = "Module",
module(
label = "Inner module",
server = function(id, datasets) {
moduleServer(
id,
module = function(input, output, session) {
output$data <- renderDataTable(datasets$get_data("iris"))
}
)
},
ui = function(id, datasets) {
ns <- NS(id)
tagList(dataTableOutput(ns("data")))
},
filters = "all"
)
),
module(
label = "Another module",
server = function(id, datasets) {
moduleServer(
id,
module = function(input, output, session) {
output$text <- renderText("Another module")
}
)
},
ui = function(id, datasets) {
ns <- NS(id)
tagList(textOutput(ns("text")))
},
filters = NULL
)
)
)
if (FALSE) {
runApp(app)
}