I am currently trying to make a Flexdashboard shiny app. I want to be able to display different UI in my sidebar given which tab is active in my output zone.
For this I considered using a renderUI
and some basic conditions. But my problem is that I don't know how to get the active tab in flexdashboard. I have done some research but I wasn't able to find the info. I am not sure if we can add id to a tabset as in shiny and if it is possible, how to get the result corresponding to the id.
Here is some skeleton code of what I would like to do :
---
title: "Test"
runtime: shiny
output:
flexdashboard::flex_dashboard:
vertical_layout: scroll
---
```{r setup, include=FALSE}
suppressPackageStartupMessages({
library(shiny)
library(flexdashboard)
})
```
# Page 1
## Input {.sidebar}
```{r}
radioButtons("radio", label = h3("Radio buttons"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1)
output$list1 <- renderUI({
if (tab == "Tabs 1") {
selectInput("select", label = h3("Select box"),
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1)
}
else {}
})
uiOutput("list1")
```
Column {.tabset }
-------------------------------------
### Tab 1
### Tab 2
### Tab 3
Thanks for your help :)