-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconditionalPanel.R
36 lines (33 loc) · 1.03 KB
/
conditionalPanel.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
header = dashboardHeader(title = 'Menu'),
sidebar = dashboardSidebar(
conditionalPanel(
condition = "input.conditional_panel == 'Show_only_item1'",
sidebarMenu(menuItem(
'Item 1', tabName = 'item1',
menuSubItem('Item A', tabName = 'item1A'),
menuSubItem('Item B', tabName = 'item1B')
))
),
conditionalPanel(
condition = "input.conditional_panel == 'Show_item1_item2'",
sidebarMenu(
menuItem('Item 1', tabName = 'item1',
menuSubItem('Item A', tabName = 'item1A')
),
menuItem('Item 2', tabName = 'item2',
menuSubItem('Item C', tabName = 'item2C'),
menuSubItem('Item D', tabName = 'item2D')
)
)
)
),
body = dashboardBody(
selectInput(inputId = 'conditional_panel', label = 'Data type',
choices = c('Show_only_item1', 'Show_item1_item2'))
)
)
server <- function(...){}
shinyApp(ui = ui, server = server)