Class Accordion#

Inheritance Relationships#

Base Type#

Class Documentation#

class Accordion : public Karana::WebUI::Widget#

Collapsible container for widgets.

Public Functions

Accordion(Router &router, std::string_view summary = "", std::function<void(bool)> on_toggle = nullptr, std::string_view exclusive_tag = "", const Karana::Core::ks_ptr<State> &open_state = nullptr)#

Accordion constructor.

Parameters:
  • router – Used to establish the frontend connection

  • summary – Summary text to always display

  • on_toggle – Called when the open state is toggled

  • exclusive_tag – If not empty, groups the accordion with any other accordions sharing the same tag. Grouped accordions may be placed anywhere in the widget hierarchy, and grouping does not affect the layout, but only one accordion within a group may be open at a time.

  • open_stateState for whether the accordion is open

virtual ~Accordion()#

Accordion destructor.

void addChild(const Karana::Core::ks_ptr<Widget> &widget)#

Add a widget as a child DOM element.

Parameters:

widget – The widget to add

void setOpen(bool open, bool trigger_own_callback = false)#

Set whether the accordion is open.

Parameters:
  • open – True if the accordion is open

  • trigger_own_callback – Whether to invoke the on_toggle callback

Protected Functions

virtual void _onConnect(int client_id) override#

Called upon a client connecting.

This can be overridden to implement custom behavior.

Parameters:

client_id – Unique id for the client.