-
Notifications
You must be signed in to change notification settings - Fork 1
/
shinyBS_PopUp.R
45 lines (44 loc) · 1.68 KB
/
shinyBS_PopUp.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
37
38
39
40
41
42
43
44
45
library(shiny)
library(shinyBS)
shinyApp(
ui =
fluidPage(
sidebarLayout(
sidebarPanel(HTML("This button will open Panel 1 using updateCollapse."),
actionButton("p1Button", "Push Me!"),
selectInput("styleSelect", "Select style for Panel 1",
c("default", "primary", "danger", "warning", "info", "success"))
),
mainPanel(
bsCollapse(id = "collapseExample", open = "Panel 2",
bsCollapsePanel("Panel 1", "This is a panel.", fluidRow(
column(4,
"4"
)
),
fluidRow(
column(3,
"3"
)
),style = "info"),
bsCollapsePanel("Panel 2", "This panel has a generic plot. ",
"and a 'success' style.", plotOutput("genericPlot"), style = "success")
)
)
)
),
server =
function(input, output, session) {
output$genericPlot <- renderPlot(plot(rnorm(100)))
observeEvent(input$p1Button, ({
updateCollapse(session, "collapseExample", open = "Panel 1")
}))
observeEvent(input$styleSelect, ({
updateCollapse(session, "collapseExample", style = list("Panel 1" = input$styleSelect))
}))
observeEvent(input$collapseExample,({
cat("\n. Collapse:")
cat(input$collapseExample)
}))
}
)