bootstack.AccordionSection#

class bootstack.AccordionSection(internal_expander, *, key, layout='vstack', padding=None, gap=0, fill_items=None, expand_items=None, anchor_items=None, columns=None, rows=None, sticky_items=None, auto_flow='row')#

Bases: object

A handle for one accordion section — both a layout context and a live controller.

Returned by Accordion.add() and by Accordion.item() / items(). Use it as a with block to place child widgets inside the section, and read or call key / title / expanded / expand() / collapse() / toggle() to inspect or drive the section afterward.

As a context manager it accepts the same layout kwargs as the standalone layout containers — layout=, gap=, fill_items=, expand_items=, anchor_items=, columns=, rows=, sticky_items=, auto_flow=.

property expanded: bool#

Whether the section is currently expanded.

property key: str#

The section’s unique key, used with Accordion.item()/remove().

property title: str#

The section header text. Assigning a new value relabels the header.

collapse()#

Collapse this section.

expand()#

Expand this section.

guide_layout(child, **layout_kw)#
toggle()#

Toggle this section between expanded and collapsed.