Accordion
accordion · Containers · interactive
Sections that open one at a time, or several.
Import
cpp
#include "gbui/widgets/accordion.hpp"Example
cpp
AccordionResult accordion(Ui& ui, const Interaction& input, std::string_view id, const std::vector<AccordionSection>& sections, AccordionState& state, const AccordionOptions& options = {});A stack of collapsible sections. Enter or Space on a header opens it, the arrows move between headers, and Home and End reach the ends. Every header carries expanded, so a reader is told what a press will do before they make it.
API
AccordionOptions
| Option | Type | Default | What it does |
|---|---|---|---|
exclusive | bool | false | Opening one closes the others. Off by default, and that is the less obvious choice: an accordion whose sections close each other cannot be used to compare two of them, and a reader who opens the second and loses the first will open both again one at a time. Turn it on when the sections are long enough that two of them on screen would be worse. |
name | std::string_view | What the whole stack is, for a reader arriving at it. | |
gap | float | 6.0f |