Skip to content

Containers: API ​

This page is generated from the willowui source. It lists each public class with its constructor, its setter-style methods and its callback fields. The guide page for this family explains how to use them. Methods the generator skips (internal handlers, layout and draw steps) are still reachable but are not part of the everyday surface.

AccordionSection ​

Source: src/widgets/containers/accordion.tks.

A section to add (Go AccordionSection).

ts
new AccordionSection(id: string, label: string, icon: TextureRegion | null, content: Component | null)

Accordion ​

Source: src/widgets/containers/accordion.tks. Extends Component.

ts
new Accordion(name: string)

Callback fields: onToggle.

MethodReturnsNotes
setFont(family: string, size: float)voidThe font family and size for header labels; sections added before this have no label.
addSection(section: AccordionSection)Accordion
removeSection(id: string)void
open(id: string)void
close(id: string)void
toggle(id: string)void
setExpanded(id: string, v: boolean)void
isExpanded(id: string)boolean
setExclusive(v: boolean)void
setAnimated(v: boolean)void
setOnToggle(fn: Function | null)void
bindExpanded(ref: Ref&lt;string&gt;)voidFollow a Ref<string> holding the expanded section id ("" closes all).
expandedID()stringThe first expanded section id, or "".
setSize(w: float, h: float)void
applyThemeColors()void

AnchorLayout ​

Source: src/widgets/containers/anchorlayout.tks. Extends Panel.

ts
new AnchorLayout(name: string)

ListItem ​

Source: src/widgets/containers/list.tks.

Wraps arbitrary data for use in a List (Go ListItem).

ts
new ListItem(data: any)

List ​

Source: src/widgets/containers/list.tks. Extends Component.

ts
new List(name: string, itemHeight: float)

Callback fields: onChange.

MethodReturnsNotes
applyThemeColors()void
setItems(items: ListItem[])voidReplace the data and refresh the visible items; scrolls back to the top.
bindItems(arr: ReactiveArray&lt;ListItem&gt; | null)voidFollow a ReactiveArray<ListItem>: every mutation resyncs the items and the pool without resetting the scroll position. Pass null to detach.
setRenderItem(fn: Function | null)voidThe factory that creates the Component for an item: (index: int, data: any) => Component | null.
getSelected()int
setSelected(idx: int)void
bindSelected(ref: Ref&lt;int&gt;)void
selectedRef()Ref&lt;int&gt;
selectedItem()anyThe data of the selected item, or null.
clearSelection()void
selectNext()voidSelect the next item (the first when nothing is selected), scrolled into view.
selectPrevious()voidSelect the previous item (the last when nothing is selected).
selectFirst()void
selectLast()void
scrollToSelection()void
setOnChange(fn: Function | null)void
setSelectable(enabled: boolean)voidEnable the built-in highlight behind the selected item.
isSelectable()boolean
scrollToIndex(idx: int)voidScroll so that item idx is visible.
setSize(w: float, h: float)void
setItemHeight(h: float)voidChange the row height and rebuild the visible rows (item 11472, bindable as bind:itemHeight).

Source: src/widgets/containers/navdrawer.tks. Extends Component.

ts
new NavDrawer(name: string)

Callback fields: onOpen, onClose.

MethodReturnsNotes
setContent(comp: Component | null)void
open()voidSlide the drawer into view.
close()voidSlide the drawer out of view.
toggle()void
isOpen()boolean
setPinned(v: boolean)void
isPinned()boolean
setDrawerAnchor(anchor: int)void
setWidth(w: float)void
setCloseOnBackdropClick(v: boolean)void
setOnOpen(fn: Function | null)void
setOnClose(fn: Function | null)void
bindOpen(ref: Ref&lt;boolean&gt;)voidBind the open state to a Ref: writes open or close the drawer, and user interaction writes the Ref.
setSize(w: float, h: float)voidThe overall container size (typically the full screen).
setAnimationDuration(seconds: float)void
applyThemeColors()void

SortableList ​

Source: src/widgets/containers/sortablelist.tks. Extends Component.

ts
new SortableList(name: string, itemHeight: float)

Callback fields: onChange, onReorder, onMoveDenied.

MethodReturnsNotes
applyThemeColors()void
setRenderItem(fn: Function | null)voidThe factory that creates the Component for an item: (index: int, data: any) => Component | null.
setUpdateItem(fn: Function | null)void
getSelected()int
setSelected(idx: int)void
selectedItem()anyThe data of the selected item, or null.
bindSelected(ref: Ref&lt;int&gt;)void
setOnChange(fn: Function | null)void
setDragEnabled(v: boolean)void
setKeyboardReorderEnabled(v: boolean)void
setShowHandles(v: boolean)void
setHandleSide(side: int)void
setOnReorder(fn: Function | null)void
setOnMoveDenied(fn: Function | null)void
moveItem(src: int, dst: int)voidMove an item from one index to another; the selection follows the moved item and adjusts when an unselected item moves past it.
moveSelectedUp()void
moveSelectedDown()void
scrollToIndex(idx: int)void
setSize(w: float, h: float)void
rebuild()voidClear and recreate every row component.

SortableTreeItem ​

Source: src/widgets/containers/sortabletreelist.tks.

A node in a sortable tree (Go SortableTreeItem). depth is computed from parentId.

ts
new SortableTreeItem(id: string, parentId: string, label: string)

SortableTreeList ​

Source: src/widgets/containers/sortabletreelist.tks. Extends Component.

ts
new SortableTreeList(name: string, family: string, displaySize: float)

Callback fields: onChange, onReorder.

MethodReturnsNotes
applyThemeColors()void
setItems(items: SortableTreeItem[])void
getItems()SortableTreeItem[]A copy of the current items.
setAllowReparent(v: boolean)void
setAllowCrossLevel(v: boolean)void
setOnReorder(fn: Function | null)void
setOnChange(fn: Function | null)void
setExpanded(id: string, v: boolean)void
isExpanded(id: string)boolean
expandAll()void
collapseAll()void
getSelected()int
setSelected(idx: int)void
bindSelected(ref: Ref&lt;int&gt;)void
setSize(w: float, h: float)void
moveSelectedUp()void
moveSelectedDown()void

TabBar ​

Source: src/widgets/containers/tabs.tks. Extends Component.

ts
new TabBar(name: string, family: string, displaySize: float)

Callback fields: onChange.

MethodReturnsNotes
applyThemeColors()void
addTab(label: string, content: Component | null)intAdd a tab with a label and a content panel (may be null); returns the tab index.
addTabPage(label: string, layout: int, spacing: float, padding: Insets)ComponentA tab whose content is a new page sized to the tab body; returns the page (its index is tabCount() - 1).
removeTab(index: int)void
getSelected()int
setSelected(idx: int)void
bindSelected(ref: Ref&lt;int&gt;)voidFollow a Ref<int>; the current value applies now and later writes follow at the frame boundary.
setOnChange(fn: Function | null)void
setSize(w: float, h: float)void
getOverflowMode()int
scrollOffset()floatThe scroll offset in pixels; always 0 in clip mode.
setOverflowMode(mode: int)void
scrollToTab(idx: int)voidScroll so the tab at idx is fully visible. No-op in clip mode.
scrollByOneTab(dir: int)void

TileList ​

Source: src/widgets/containers/tilelist.tks. Extends Component.

ts
new TileList(name: string, tileW: float, tileH: float)

Callback fields: onChange.

MethodReturnsNotes
applyThemeColors()void
setItems(items: ListItem[])voidReplace the data and refresh. With setUpdateItem configured, pooled components are updated in place instead of disposed and recreated.
setUpdateItem(fn: Function | null)void
bindItems(arr: ReactiveArray&lt;ListItem&gt; | null)voidFollow a ReactiveArray<ListItem>; any change resyncs the pool and keeps the scroll position.
setColumns(n: int)void
setRenderItem(fn: Function | null)void
getSelected()int
setSelected(idx: int)void
bindSelected(ref: Ref&lt;int&gt;)void
selectedRef()Ref&lt;int&gt;
selectedItem()any
clearSelection()void
selectNext()void
selectPrevious()void
selectFirst()void
selectLast()void
scrollToIndex(idx: int)voidScroll so the row holding tile idx is visible.
scrollToSelection()void
setOnChange(fn: Function | null)void
setSelectable(enabled: boolean)void
isSelectable()boolean
setSize(w: float, h: float)void

TreeNode ​

Source: src/widgets/containers/treelist.tks.

A node in a hierarchical tree (Go TreeNode).

ts
new TreeNode(data: any, children: TreeNode[])

ReactiveTreeNode ​

Source: src/widgets/containers/treelist.tks.

A tree node whose children are a reactive array (Go ReactiveTreeNode). Mutations anywhere in the subtree reach a TreeList bound with bindRoots.

ts
new ReactiveTreeNode(data: any)

TreeList ​

Source: src/widgets/containers/treelist.tks. Extends Component.

ts
new TreeList(name: string, itemHeight: float)

Callback fields: onChange.

MethodReturnsNotes
applyThemeColors()void
setSelectable(enabled: boolean)voidBuilt-in selection: a click selects the row and a highlight bar is shown.
isSelectable()boolean
getSelected()TreeNode | null
selectedRef()Ref&lt;TreeNode | null&gt;
setSelected(node: TreeNode | null)void
clearSelection()void
bindSelected(ref: Ref&lt;TreeNode | null&gt;)void
setOnChange(fn: Function | null)void
setLeafOnlySelection(enabled: boolean)voidOnly leaves can be selected; parents stay clickable for expand and collapse. No effect while not selectable.
setRoots(roots: TreeNode[])void
bindRoots(arr: ReactiveArray&lt;ReactiveTreeNode&gt; | null)voidFollow a ReactiveArray<ReactiveTreeNode>. A change anywhere in the subtree re-snapshots the tree without resetting the scroll position or the expansion state. Pass null to detach.
setToggleIcons(expand: any | null, collapse: any | null)voidCustom glyphs for the toggle buttons built by newTreeToggle (null keeps the default).
setRenderItem(fn: Function | null)void
setDefaultTextRenderer(family: string, displaySize: float, rowW: float, rowH: float)voidThe standard row: depth indent, a toggle (or a spacer for leaves) and a label. Each node's data is a string. Clicking a parent row toggles it.
expand(node: TreeNode | null)void
collapse(node: TreeNode | null)void
toggle(node: TreeNode)void
expandAll()void
collapseAll()void
isExpanded(node: TreeNode)boolean
moveSelection(delta: int)booleanMove the selection delta rows (+1 down, -1 up); false when there is no such row.
setSize(w: float, h: float)void
toggleButton(name: string, node: TreeNode)IconButton | nullA ready-made IconButton that expands or collapses node in tl; null for a leaf. The button uses the Custom1 variant and tints its glyph white by default and the theme text colour on hover or press, like the window close button. Glyph resolution: per-tree override, then the theme icon, then the chevrons.

TableColumn ​

Source: src/widgets/containers/treetable.tks.

A column of a TreeTable (Go TableColumn).

ts
new TableColumn(key: string, label: string, width: float, sortable: boolean)

TreeTableRow ​

Source: src/widgets/containers/treetable.tks.

A row of the hierarchy (Go TreeTableRow). parentId is set by the table when it flattens the nested children; "" is a root row.

ts
new TreeTableRow(id: string, cells: Map<string, string>, children: TreeTableRow[])

TreeTable ​

Source: src/widgets/containers/treetable.tks. Extends Component.

ts
new TreeTable(name: string, family: string, displaySize: float)

Callback fields: onRowClick, onRowExpand.

MethodReturnsNotes
applyThemeColors()void
setColumns(cols: TableColumn[])void
getColumns()TableColumn[]A copy of the current column definitions.
setRows(rows: TreeTableRow[])voidRows may be nested through children.
getRows()TreeTableRow[]
setSortColumn(key: string, dir: int)void
expandAll()void
collapseAll()void
setExpanded(id: string, v: boolean)void
isExpanded(id: string)boolean
setOnRowClick(fn: Function | null)void
setOnRowExpand(fn: Function | null)void
getSelected()int
setSelected(idx: int)voidSelect by flat index. Does NOT fire onRowClick.
setSize(w: float, h: float)void

TwoColumnLayout ​

Source: src/widgets/containers/twocolumnlayout.tks. Extends Panel.

ts
new TwoColumnLayout(name: string)
MethodReturnsNotes
addRow(left: Component | null, right: Component | null)voidAdd a row. With a null right, left spans both columns (clear:both).
removeRow(left: Component | null)voidRemove the row whose left (or spanning) child is left, detaching its components.
sizeToContent()voidResize to tightly wrap all rows; children must have their sizes set first.

Window ​

Source: src/widgets/containers/window.tks. Extends Component.

ts
new Window(name: string, title: string, family: string, displaySize: float)

Callback fields: onClose, onResult.

MethodReturnsNotes
applyThemeColors()void
setActive(active: boolean)void
setTitle(t: string)void
setSize(width: float, height: float)void
setTitleBarHeight(h: float)void
setMinSize(minW: float, minH: float)void
setMinWidth(v: float)void
setMinHeight(v: float)void
sizeToContent()voidFit the body to its content and size the window to match.
setResizable(v: boolean)void
setMovable(v: boolean)void
isMovable()boolean
setModal(v: boolean)void
isModal()boolean
setModalOverlayColor(c: Color)void
setOnModalOverlayClick(fn: Function | null)void
setVisible(v: boolean)void
setCloseIcon(img: any)void
setCloseable(v: boolean)void
setOnClose(fn: Function | null)void
setOnResult(fn: Function | null)void
setEscResult(key: string)void
setEnterResult(key: string)void
close()void

WindowManager ​

Source: src/widgets/containers/window.tks.

Stacks windows by z order and tracks the active (foremost) one (Go WindowManager), extended with independent layer ownership, suspension, and layer focus [H 2026-10-04].

MethodReturnsNotes
add(w: Window)voidAdds a window to this layer, transferring it from another layer if necessary. The normal visible state keeps Go's activate-on-add behaviour; a suspended layer records and hides the new window.
remove(w: Window)voidRemoves a window from this layer and clears its ownership and focus state.
focus(w: Window)voidGives this layer focus and activates w; the window must belong to this manager.
isFocused()booleanReports whether this layer currently owns application focus.
setOnFocusChanged(fn: Function | null)voidRegisters a callback invoked with the new boolean state when layer focus changes.
resume()voidRestores exactly the per-window visibility recorded by suspend and later visibility requests.
isSuspended()booleanReports whether this layer is currently hiding and suppressing its windows.