#' test UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_test_ui <- function(id, label = "Counter") {
ns <- NS(id)
tagList(
actionButton(ns("button"), label = label),
verbatimTextOutput(ns("out"))
)
}
#' test Server Function
#'
#' @noRd
mod_test_server <- function(id) {
moduleServer(
id,
function(input, output, session) {
count <- reactiveVal(0)
observeEvent(input$button, {
count(count() + 1)
})
output$out <- renderText({
count()
})
count
}
)
}
## To be copied in the UI
# mod_test_ui("counter1", "Counter #1")
## To be copied in the server
# mod_test_server("counter1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.