I want to get the output from the tabBox()
which is input$tabset1
.
I have had a look at the documentation, but it seems to behave a bit differently in the module:
https://rstudio.github.io/shinydashboard/structure.html#tabbox
# module -----------------------------------------------------------------
test_ui <- function(id) {
ns <- NS(id)
tagList(
box(
width = 12,
title = "test",
# just to look at the output
uiOutput(ns("text")),
tabBox(
id = "tabset1", # see https://rstudio.github.io/shinydashboard/structure.html#tabbox
tabPanel("Tab1", "First tab content"),
tabPanel("Tab2", "Tab content 2")
)
)
)
}
test_server <- function(id){
moduleServer(id, function(input, output, session){
# reactive variables -----------------
rtab <- reactive(input$tabset1)
# test
output$text <- renderUI(paste("tab: ", rtab()))
}) # end module
} # end server
# app -----------------------------------------------
library(shinydashboard)
library(shiny)
ui <- dashboardPage(
dashboardHeader(title = "test"),
dashboardSidebar(),
dashboardBody(
test_ui("a")
)
)
server <- function(input, output) {
test_server("a")
}
shinyApp(ui, server)