Collapsible

Inherits: Node > Object

Description

Component with collapsible behavior to easily be attached to any UI needs. It takes two variables, the NodePath for a text element which will be handled to give feedback for collapsible options or state, and a NodePath for the node that must be toggled when collapsed.

If attached directly to a Button of any kind, it will auto connect with the “pressed” signal. If this behavior is not desirable, just uncheck the option should_auto_connect

Properties

type property default value
NodePath text_element_path ""
NodePath collapsible_node_path ""
bool should_auto_connect True

Methods

return type method signature
null toggle_collapse()
null handle_text()

Properties Descriptions

text_element_path

Default ""

NodePath for the feedback text.


collapsible_node_path

Default ""

NodePath for the node that must be toggled on/off when collapsed.


should_auto_connect

  • bool should_auto_connect
Default True

Turn this off if you don’t want the component to try to auto connect with the pressed signal of the parent, in case the parent is a Button.


Method Descriptions

toggle_collapse

  • void toggle_collapse()

Will collapse/expand the target node, and also trigger a change in the text as additional feedback


handle_text

  • void handle_text()

Prepends a “+” to the text when the element is closed (collapsed) or a “-” when the element is visible (expanded).