When using shiny modules, is there a way to change certain input widgets inside a shiny module. Here is some reprex;
I have the following module to create a header section on a shiny page. You'll notice that there are 2 action buttons;
nameUI <- function(id) {
ns <- NS(id)
tagList(
wellPanel(
id = ns("ui_input_well"),
div(
# first action button
actionButton(ns("add_qty"), "Add Stock Qty", icon = icon("plus")),
div(
class = "pull-right",
# second action button
actionButton(ns("info_button"), "Help", icon = icon("info-circle"))
)
)
)
)
}
nameServer <- function(id) {
moduleServer(
id,
function(input, output, session) {
}
)
}
So I'm able to use this module on a shiny tab. See example below -
library(shiny)
source("reprex_functions.R")
ui <- fluidPage(
titlePanel("Simple Shiny App"),
mainPanel(
h1("Hello, Shiny!"),
hr(),
# using the module
nameUI("header")
)
)
server <- function(input, output) {
# This is an empty server function for this example
}
shinyApp(ui, server)
Now say I wanted to use the same module on another tab, but instead of the first action button, I wanted to add numericInput("num", label = h3("Numeric input"), value = 1)
instead. Is this possible to do in a module, or do I need to create a new module since I'm changing an input widget.