Reputation: 3
How can I show a description according to the input that was selected in shiny sidebar?
Here is a part of my code:
ui=pageWithSidebar(
headerPanel("CC"),
sidebarPanel(
helpText("Create demographic"),
selectInput("var",
label = "Choose a variable to display",
choices = c("a", "b",
"c", "d"),
selected = "a")
),
mainPanel(fluidPage(
ShinyCyJSOutput(outputId = 'cy')
)
))
When selecting a,b,c or d I want a description to appear.
Upvotes: 0
Views: 59
Reputation: 10365
You could use conditionalPanel
s:
library(shiny)
ui <- pageWithSidebar(
headerPanel("CC"),
sidebarPanel(
helpText("Create demographic"),
selectInput("var",
label = "Choose a variable to display",
choices = c("a", "b",
"c", "d"),
selected = "a"),
conditionalPanel(condition = "input.var == 'a'",
tags$div("Explanation for variable a")),
conditionalPanel(condition = "input.var == 'b'",
tags$div("Explanation for variable b"))
),
mainPanel(fluidPage(
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
Upvotes: 1