tui.collapse
tui.collapse PANE [toggle|on|off]
Collapses (on), expands (off) or toggles (default) a collapsible pane, then lays out again.
Parameters
PANE- pane id. Must havecollapsible="true"(or be a<details>) in anhorvsplit.-
MODE- enum (toggleon off), optional, default toggle.
Returns: 1 when PANE is not collapsible, the mode is unknown or nothing changed.
Notes
- A collapsed pane shrinks along its parent’s split axis to
collapse_to(title,0orrail); the freed space goes to the siblings with anfrweight and expanding restores the previous size spec. The widgets of a collapsed pane, including those in panes nested inside it, are hidden: not drawn, focusable or hit-testable, and focus inside the pane moves to the next focusable widget. A rail shows each button’scollapsed_textinstead. - In an exclusive
<accordion>expanding a pane collapses its siblings.on_togglecallbacks (FN PANE STATE,STATEiscollapsedorexpanded) run for every pane that changed,on_resizecallbacks for every pane that changed size. - A collapsible pane has a collapse button: a 2-cell control drawn on its border at the corner of the edge that moves. In an
hsplit that is the top of the right edge (the left edge for the last pane), in avsplit the left end of the bottom edge (the top edge for the last pane). The arrow points where the edge moves (◀for an expanded first pane,▶for an expanded last pane,▲/▼in avsplit) and flips while collapsed. It stays visible on arailortitlebar;collapse_to="0"has none. A click on it calls this withtoggle;alt+c(tui.action.collapse_toggle) does it from the keyboard. - Theme classes:
.collapse_button(base),.collapse_button:hover(the pointer is over it) and.collapse_button:collapsed(the pane is collapsed; hover wins over it, field by field). A pane picks another class withcollapse_class="NAME"(NAME,NAME:hover,NAME:collapsed; the validator warns when no theme defines it). Resizable borders use.resize_handle:hoverthe same way. Every bundled theme defines all of them. - Keyboard:
alt+cis shown in the footer asalt+c Collapse/alt+c Expandwhile the focus is inside a collapsible pane (it does not fire while a text input has focus: the input owns it).collapse_key="KEY"(any key name of the bind table, e.g.ctrl+1,f5) binds a direct toggle for that pane that works from anywhere on the page, also from a text input; the bind is dropped with the page. The validator reports an unknown key name and a key used twice on the page (also against a<bind key>) as errors.
See also: tui.collapsed, tui.resize
