Skip to main content
Accordion of one or more items.

Usage

mo.accordion(
    {"Tip": "Use accordions to let users reveal and hide content."}
)
Accordion content can be lazily loaded:
mo.accordion({"View total": expensive_item}, lazy=True)
where expensive_item is the item to render, or a callable that returns the item to render.

Signature

mo.accordion(
    items: dict[str, object],
    multiple: bool = False,
    lazy: bool = False
) -> Html

Parameters

items
dict[str, object]
required
A dictionary of item names to item content; strings are interpreted as markdown.
multiple
bool
default:"False"
Whether to allow multiple items to be open simultaneously.
lazy
bool
default:"False"
A boolean, whether to lazily load the accordion content. This is a convenience that wraps each accordion in a mo.lazy component.

Returns

Html
An Html object.

Build docs developers (and LLMs) love