modularTabPanels: Load UI code into Shiny App from files

Description Usage Arguments Details Value Examples

View source: R/modularTabPanels.R

Description

Maps over modules, converting Shiny UI code into tabPanel() objects.

Usage

1
modularTabPanels(module.dir, module.file, numbered = FALSE)

Arguments

module.dir

Path to directory that contains modules (child directories)

module.file

Name of file found within module directories that contains UI code

numbered

If TRUE, directories will be ordered by numeric prefix (e.g., 01_Index, 02_About)

Details

This function can be used on its own if desired, but modularUI() can be used to pass the tabPanels to a UI function more succinctly.

Value

A list of Shiny tabPanel() objects

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create a list of tabPanels from ui.R files
## Not run: 
server <- function(input, output, session) {
  tabPanels <- modularTabPanels(
    module.dir = file.path('.', 'modules'),
    module.file = 'ui.R',
    numbered = TRUE
  )
}

## End(Not run)

ndrewGele/polish documentation built on March 9, 2021, 6:34 p.m.