accordion | R Documentation |
Created component provides basic accordion functionality - enroll/collapse behavior with only necessary styling (enrolled state icon). In order to provide custom styling for accordion items configure its header and content accordingly while constructing the item (see accordionItem).
accordion(id, ..., class = "")
id |
Id of the accordion component. |
... |
Accordion items created with accordionItem. |
class |
Extra class added to accordion container. |
A 'shiny.tag' object defining html structure of accordion container.
# Basic construction with simple header and content if (interactive()) { library(shiny) ui <- fluidPage( actionButton("new", "New"), accordion( "acc", accordionItem("first", "Hello", "There", active = TRUE), accordionItem("second", "General", "Kenobi") ) ) server <- function(input, output, session) { observeEvent(input$new, { addAccordionItem("acc", accordionItem(sample(letters, 1), "New", "Accordion", active = TRUE)) }) } shinyApp(ui, server) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.