Provides a button to add views/cards to a report.
For more details see the vignette: vignette("simpleReporter", "teal.reporter").
Usage
add_card_button_ui(id, label = NULL)
add_card_button_srv(id, reporter, card_fun, card_title = "")Arguments
- id
(
character(1)) thisshinymodule's id.- label
(
character(1)) label of the button. By default it is empty.- reporter
(
Reporter) instance.- card_fun
(
function) which returns aReportCardinstance. SeeDetails.- card_title
(
character(1)) default value for the card title input field. By default it is empty.
Details
The card_fun function is designed to create a new ReportCard instance and optionally customize it:
The
teal_cardparameter allows for specifying a custom or defaultReportCardinstance.Use the
commentparameter to add a comment to the card viacard$append_text()- ifcard_fundoes not have thecommentparameter, thencommentfromAdd Card UImodule will be added at the end of the content of the card.The
labelparameter enables customization of the card's name and its content throughcard$append_text()- ifcard_fundoes not have thelabelparameter, then card name will be set to the name passed inAdd Card UImodule, but no text will be added to the content of theteal_card.
This module supports using a subclass of ReportCard for added flexibility.
A subclass instance should be passed as the default value of
the teal_card argument in the card_fun function.
See below:
CustomReportCard <- R6::R6Class(
classname = "CustomReportCard",
inherit = teal.reporter::ReportCard
)
custom_function <- function(card = CustomReportCard$new()) {
card
}