express.ui.accordion_panel

express.ui.accordion_panel(title, *, value=MISSING, icon=None, **kwargs)

Context manager for single accordion panel.

This function wraps accordion_panel.

Parameters

title : TagChild

A title to appear in the accordion_panel’s header.

value : Optional[str] | MISSING_TYPE = MISSING

A character string that uniquely identifies this panel. If MISSING, the title will be used.

icon : Optional[TagChild] = None

A Tag which is positioned just before the title.

****kwargs** : TagAttrValue = {}

Tag attributes to the accordion-body div Tag.

Examples

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400

## file: app.py
from shiny.express import input, render, ui

with ui.accordion(id="acc"):
    for letter in "ABCDE":
        with ui.accordion_panel(f"Section {letter}"):
            f"Some narrative for section {letter}"


@render.code
def acc_val():
    return "input.acc(): " + str(input.acc())