Skip to contents

Example of a simple module.

Usage

counter_button_app(...)

counter_button_ui(id, label = "Counter")

counter_button_server(id, set_to = 0L, increment_by = shiny::reactiveVal(1L))

Arguments

...

Arguments passed on to module2app

module_ui,module_server

Module functions.

ui_args,server_args

Additional arguments passed to module_serverand module_ui. server_args can be shiny::reactive()s, if corresponding argument in module_server accepts it.

ui_wrapper

A function to wrap the resulting shiny::tagList() in. Must yield a full shiny UI, such as shiny::basicPage() or shiny::bootstrapPage(). For maximum reusability of a module, avoid depending on the wrapper and only return "vanilla" UI.

options

Named options that should be passed to the runApp call (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode"). You can also specify width and height parameters which provide a hint to the embedding environment about the ideal height/width for the app.

id

The id string to be namespaced (optional).

label

The contents of the button or link–usually a text label, but you could also use any other HTML, like an image.

set_to

Giving the value to set the counter to.

increment_by

A reactive, giving the value to increment the counter by.

Functions

  • counter_button_app(): Test app

  • counter_button_ui(): Module UI

  • counter_button_server(): Module Server