← Back to Components

Accordion

Collapsible content sections with single or multiple open modes and animated panel height.

Interactive Playground

R Code

API Reference

block_accordion()

Vertically stacked collapsible sections built from block_accordion_item(); reports open value(s) to input$id when id is set.

ArgumentTypeDefaultDescription
...block_accordion_item()requiredOne or more block_accordion_item() sections.
idcharacterNULLOptional input id; input$id reports the open value(s).
type'single' | 'multiple''single'One open at a time, or any number open independently. Create-only.
collapsiblelogicalFALSESingle mode: whether the open item can collapse to none. Create-only.
opencharacterNULLItem value(s) open initially. Must match item values.
stylecharacterNULLInline styles on the accordion wrapper.
classcharacterNULLAdditional classes on the accordion wrapper.

block_accordion_item()

A single collapsible section: a trigger title that expands or collapses arbitrary body content.

ArgumentTypeDefaultDescription
valuecharacterrequiredUnique item id; reported to input$id and targeted by updates.
titlecharacter | shiny.tagrequiredTrigger label.
...shiny.tag | tagListrequiredPanel body content.
iconcharacter | shiny.tagNULLOptional leading icon before the title.
disabledlogicalFALSEWhether the item cannot be toggled.
classcharacterNULLAdditional classes on the item wrapper.

update_block_accordion()

Server-driven update: open or close items by value.

ArgumentTypeDefaultDescription
sessionShinySessionrequiredActive R/Shiny session.
input_idcharacterrequiredAccordion input id.
opencharacter-Item value(s) that should be open after the update; NULL/character(0) closes all.
notifylogicalTRUEWhether Shiny receives an input event after the update.