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
- Accordion
- AnchorLayout
- ListItem
- List
- NavDrawer
- SortableList
- SortableTreeItem
- SortableTreeList
- TabBar
- TileList
- TreeNode
- ReactiveTreeNode
- TreeList
- TableColumn
- TreeTableRow
- TreeTable
- TwoColumnLayout
- Window
- WindowManager
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.
| Method | Returns | Notes |
|---|---|---|
setFont(family: string, size: float) | void | The 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<string>) | void | Follow a Ref<string> holding the expanded section id ("" closes all). |
expandedID() | string | The 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.
| Method | Returns | Notes |
|---|---|---|
applyThemeColors() | void | |
setItems(items: ListItem[]) | void | Replace the data and refresh the visible items; scrolls back to the top. |
bindItems(arr: ReactiveArray<ListItem> | null) | void | Follow a ReactiveArray<ListItem>: every mutation resyncs the items and the pool without resetting the scroll position. Pass null to detach. |
setRenderItem(fn: Function | null) | void | The factory that creates the Component for an item: (index: int, data: any) => Component | null. |
getSelected() | int | |
setSelected(idx: int) | void | |
bindSelected(ref: Ref<int>) | void | |
selectedRef() | Ref<int> | |
selectedItem() | any | The data of the selected item, or null. |
clearSelection() | void | |
selectNext() | void | Select the next item (the first when nothing is selected), scrolled into view. |
selectPrevious() | void | Select the previous item (the last when nothing is selected). |
selectFirst() | void | |
selectLast() | void | |
scrollToSelection() | void | |
setOnChange(fn: Function | null) | void | |
setSelectable(enabled: boolean) | void | Enable the built-in highlight behind the selected item. |
isSelectable() | boolean | |
scrollToIndex(idx: int) | void | Scroll so that item idx is visible. |
setSize(w: float, h: float) | void | |
setItemHeight(h: float) | void | Change the row height and rebuild the visible rows (item 11472, bindable as bind:itemHeight). |
NavDrawer
Source: src/widgets/containers/navdrawer.tks. Extends Component.
ts
new NavDrawer(name: string)Callback fields: onOpen, onClose.
| Method | Returns | Notes |
|---|---|---|
setContent(comp: Component | null) | void | |
open() | void | Slide the drawer into view. |
close() | void | Slide 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<boolean>) | void | Bind the open state to a Ref: writes open or close the drawer, and user interaction writes the Ref. |
setSize(w: float, h: float) | void | The 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.
| Method | Returns | Notes |
|---|---|---|
applyThemeColors() | void | |
setRenderItem(fn: Function | null) | void | The 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() | any | The data of the selected item, or null. |
bindSelected(ref: Ref<int>) | 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) | void | Move 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() | void | Clear 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.
| Method | Returns | Notes |
|---|---|---|
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<int>) | 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.
| Method | Returns | Notes |
|---|---|---|
applyThemeColors() | void | |
addTab(label: string, content: Component | null) | int | Add 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) | Component | A 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<int>) | void | Follow 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() | float | The scroll offset in pixels; always 0 in clip mode. |
setOverflowMode(mode: int) | void | |
scrollToTab(idx: int) | void | Scroll 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.
| Method | Returns | Notes |
|---|---|---|
applyThemeColors() | void | |
setItems(items: ListItem[]) | void | Replace 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<ListItem> | null) | void | Follow 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<int>) | void | |
selectedRef() | Ref<int> | |
selectedItem() | any | |
clearSelection() | void | |
selectNext() | void | |
selectPrevious() | void | |
selectFirst() | void | |
selectLast() | void | |
scrollToIndex(idx: int) | void | Scroll 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.
| Method | Returns | Notes |
|---|---|---|
applyThemeColors() | void | |
setSelectable(enabled: boolean) | void | Built-in selection: a click selects the row and a highlight bar is shown. |
isSelectable() | boolean | |
getSelected() | TreeNode | null | |
selectedRef() | Ref<TreeNode | null> | |
setSelected(node: TreeNode | null) | void | |
clearSelection() | void | |
bindSelected(ref: Ref<TreeNode | null>) | void | |
setOnChange(fn: Function | null) | void | |
setLeafOnlySelection(enabled: boolean) | void | Only leaves can be selected; parents stay clickable for expand and collapse. No effect while not selectable. |
setRoots(roots: TreeNode[]) | void | |
bindRoots(arr: ReactiveArray<ReactiveTreeNode> | null) | void | Follow 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) | void | Custom 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) | void | The 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) | boolean | Move 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 | null | A 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.
| Method | Returns | Notes |
|---|---|---|
applyThemeColors() | void | |
setColumns(cols: TableColumn[]) | void | |
getColumns() | TableColumn[] | A copy of the current column definitions. |
setRows(rows: TreeTableRow[]) | void | Rows 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) | void | Select 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)| Method | Returns | Notes |
|---|---|---|
addRow(left: Component | null, right: Component | null) | void | Add a row. With a null right, left spans both columns (clear:both). |
removeRow(left: Component | null) | void | Remove the row whose left (or spanning) child is left, detaching its components. |
sizeToContent() | void | Resize 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.
| Method | Returns | Notes |
|---|---|---|
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() | void | Fit 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].
| Method | Returns | Notes |
|---|---|---|
add(w: Window) | void | Adds 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) | void | Removes a window from this layer and clears its ownership and focus state. |
focus(w: Window) | void | Gives this layer focus and activates w; the window must belong to this manager. |
isFocused() | boolean | Reports whether this layer currently owns application focus. |
setOnFocusChanged(fn: Function | null) | void | Registers a callback invoked with the new boolean state when layer focus changes. |
resume() | void | Restores exactly the per-window visibility recorded by suspend and later visibility requests. |
isSuspended() | boolean | Reports whether this layer is currently hiding and suppressing its windows. |