Creates a teal_module
object.
module.Rd
This function embeds a shiny
module inside a teal
application. One teal_module
maps to one shiny
module.
Usage
module(
label = "module",
server = function(id, ...) {
moduleServer(id, function(input, output, session) {
})
},
ui = function(id, ...) {
tags$p(paste0("This module has no UI (id: ", id, " )"))
},
filters = "all",
server_args = NULL,
ui_args = NULL
)
# S3 method for teal_module
toString(x, indent = 0, ...)
# S3 method for teal_module
print(x, ...)
Arguments
- label
(
character(1)
) Label shown in the navigation item for the module.- server
-
(
function
)shiny
module with following arguments:id
- teal will set proper shiny namespace for this module (seeshiny::moduleServer()
).input
,output
,session
- (not recommended) thenshiny::callModule()
will be used to call a module.data
(optional) module will receive list of reactive (filtered) data specified in thefilters
argument.filters
can't be NULLdatasets
(optional) module will receiveFilteredData
. (See[teal.slice::FilteredData]
).reporter
(optional) module will receiveReporter
. (See teal.reporter::Reporter)....
(optional)server_args
elements will be passed to the module named argument or to the...
.
- ui
-
(
function
) Shiny ui module function with following arguments:id
- teal will set proper shiny namespace for this module.data
(optional) module will receive list of reactive (filtered) data specified in thefilters
argument.datasets
(optional) module will receiveFilteredData
. (See[teal.slice::FilteredData]
)....
(optional)ui_args
elements will be passed to the module named argument or to the...
.
- filters
(
character
) A vector with datanames that are relevant for the item. The filter panel will automatically update the shown filters to include only filters in the listed datasets.NULL
will hide the filter panel, and the keyword'all'
will show the filters of all datasets.filters
can't beNULL
whendata
argument is present in theserver
formals.- server_args
(named
list
) with additional arguments passed on to theserver
function.- ui_args
(named
list
) with additional arguments passed on to theui
function.- x
teal_module
- indent
(
integer
) indent level; each submodule is indented one level more- ...
parameters passed to
toString
Examples
library(shiny)
app <- init(
data = teal_data(dataset("iris", iris)),
modules = list(
module(
label = "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")))
}
)
)
)
if (FALSE) {
runApp(app)
}