if (FALSE) { # rlang::is_interactive()
items <- lapply(LETTERS, function(x) {
accordion_panel(paste("Section", x), paste("Some narrative for section", x))
})
# First shown by default
accordion(!!!items)
# Nothing shown by default
accordion(!!!items, open = FALSE)
# Everything shown by default
accordion(!!!items, open = TRUE)
# Show particular sections
accordion(!!!items, open = "Section B")
accordion(!!!items, open = c("Section A", "Section B"))
# Provide an id to create a shiny input binding
library(shiny)
ui <- page_fluid(
accordion(!!!items, id = "acc")
)
server <- function(input, output) {
observe(print(input$acc))
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab