Skip to content

Interactive widgets: 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.

CalendarDayCell ​

Source: src/widgets/interactive/calendarselector.tks.

A single day cell in the grid.

ts
new CalendarDayCell(container: Node, bg: Quad, label: Text)

CalendarSelector ​

Source: src/widgets/interactive/calendarselector.tks. Extends Component.

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

Callback fields: onDateSelected.

MethodReturnsNotes
setDate(t: Date)voidThe selected date, and navigate to its month. Does not fire onDateSelected.
setMinDate(t: Date)void
setMaxDate(t: Date)void
clearMinDate()void
clearMaxDate()void
setPopupMode(v: boolean)voidSwitch between inline and popup display.
isPopupMode()boolean
openPopup()voidOpen the popup calendar (popup mode only).
closePopup()voidClose the popup calendar (popup mode only).
setMonth(year: int, month: int)voidNavigate the view to a year and month (1-12).
setOnDateSelected(fn: Function | null)void
bindDate(ref: Ref<Date>)voidThe selected date follows the ref and user picks write to it.
setSize(w: float, h: float)void
setEnabled(v: boolean)void
isDateDisabled(t: Date)boolean

Checkbox ​

Source: src/widgets/interactive/checkbox.tks. Extends Component.

ts
new Checkbox(name: string, text: string, family: string, displaySize: float)

Callback fields: onChange.

MethodReturnsNotes
setChecked(v: boolean)void
setText(text: string)void
bindValue(ref: Ref<boolean>)voidThe checkbox follows the ref (initial value applied now), and clicks write to it.
setCheckIcon(img: TextureRegion)voidReplace the built-in check glyph with a custom image, shown at the box size.
setEnabled(v: boolean)void

ContextMenu ​

Source: src/widgets/interactive/contextmenu.tks.

ts
new ContextMenu(family: string, displaySize: float)
MethodReturnsNotes
setItems(items: MenuItem[])voidReplace the item list.
setVariant(v: int)void
showAt(x: float, y: float)voidOpen the menu with its top-left at (x, y) in world/screen coordinates.
hide()voidClose the menu if it is open.

DragHandle ​

Source: src/widgets/interactive/draghandle.tks. Extends Component.

ts
new DragHandle(name: string)

Callback fields: onDragStart, onDrag, onDragEnd.

MethodReturnsNotes
setAxis(a: int)void
setTarget(c: Component | null)void
clearTarget()void
setGripStyle(s: int)void
setSize(w: float, h: float)void
setEnabled(v: boolean)void

ImageCropper ​

Source: src/widgets/interactive/imagecropper.tks. Extends Component.

ts
new ImageCropper(name: string)

Callback fields: onCropChanged.

MethodReturnsNotes
setImage(img: Texture | null)voidSet the source image (null clears it). The crop defaults to the whole image the first time.
setCropRect(x: float, y: float, w: float, h: float)voidThe crop rectangle in image-pixel coordinates.
setAspectRatio(w: float, h: float)voidConstrain the crop to a fixed aspect ratio; 0, 0 is free.
setMinSize(w: float, h: float)void
setMaxSize(w: float, h: float)void
setShowGrid(v: boolean)voidThe rule-of-thirds grid overlay.
setOnCropChanged(fn: Function | null)voidFired during handle drags with the new crop rectangle.
setSize(w: float, h: float)void
startDrag(handleIdx: int, gx: float, gy: float)voidBegin a drag of a handle (or -1 to move the whole rect) at the global pointer position.

KeybindInput ​

Source: src/widgets/interactive/keybindinput.tks. Extends Component.

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

Callback fields: onBindingChanged, onConflict.

MethodReturnsNotes
getBinding()KeyBinding
setBinding(b: KeyBinding)voidSet the binding without entering listening mode or firing the callback.
clearBinding()void
setListening(v: boolean)void
isListening()boolean
setCombosEnabled(v: boolean)void
setOnBindingChanged(fn: Function | null)void
setOnConflict(fn: Function | null)voidReturn false from the callback to reject a binding.
bindValue(ref: Ref<KeyBinding>)voidThe binding follows the ref and user captures write to it.
setSize(w: float, h: float)void
setEnabled(v: boolean)void

Source: src/widgets/interactive/menubar.tks.

One top-level menu in the bar.

ts
new MenuBarEntry(label: string, items: MenuItem[])

Source: src/widgets/interactive/menubar.tks.

Per-entry visual data.

ts
new MenuBarNode(bg: Quad, label: Text, hit: Node, x: float, w: float)

Source: src/widgets/interactive/menubar.tks. Extends Component.

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

Callback fields: onMenuOpen, onMenuClose.

MethodReturnsNotes
setEntries(entries: MenuBarEntry[])void
setEntry(index: int, entry: MenuBarEntry)voidReplace one entry; out of range is ignored.
setSize(w: float, h: float)void
setOnMenuOpen(fn: Function | null)void
setOnMenuClose(fn: Function | null)void
applyTheme()void
rebuild()void
hideOverlay()voidRemove the overlay and restore the normal entry node references.
openMenu(index: int)void
closeMenu()voidClose the open dropdown; the popup's onDismiss does the state cleanup.

Source: src/widgets/interactive/menupopup.tks.

A single entry in a MenuPopup.

ts
new MenuItem(label: string, onSelect: Function | null)

Callback fields: onSelect.

Source: src/widgets/interactive/menupopup.tks.

ts
new MenuPopup(family: string, displaySize: float)

Callback fields: onDismiss.

MethodReturnsNotes
setItems(items: MenuItem[])void
setOnDismiss(fn: Function | null)void
setVariant(v: int)void
scrollToHighlighted()voidKeep the highlighted item in view when navigating by keyboard in a scrollable popup.

Source: src/widgets/interactive/menupopup.tks.

Manages the single active floating menu popup. Use DEFAULT_MENU_POPUP_MANAGER.

MethodReturnsNotes
setScene(s: any)void
show(popup: MenuPopup, trigger: Component | null)voidDisplay popup below (or above) the trigger component.
showAt(popup: MenuPopup, x: float, y: float)voidDisplay popup with its top-left at (x, y).
hide()voidClose the active popup without a selection.
isOpen()boolean
dismiss()void
hideActive()void
setHighlight(idx: int)voidItem pointer enter.
clearHighlight(idx: int)voidItem pointer leave.
selectItem(idx: int)voidFire the item's onSelect and close the popup.

OptionRotator ​

Source: src/widgets/interactive/optionrotator.tks. Extends Component.

ts
new OptionRotator(name: string, options: string[], family: string, displaySize: float)

Callback fields: onChange.

MethodReturnsNotes
setOptions(opts: string[])voidReplaces the list; the index is clamped and onChange fires when that moves it.
setSelected(i: int)voidThe index is clamped; onChange fires only when the selection changes.
setWrap(v: boolean)void
setChevronIcons(left: TextureRegion | null, right: TextureRegion | null)voidEither icon may be null to keep the theme or built-in chevron for that side.
bindOptions(arr: ReactiveArray<string> | null)voidThe options follow a ReactiveArray; the selection is clamped. Pass null to detach.
bindSelected(ref: Ref<int>)voidThe index follows the ref and user changes write to it. Replaces any previous binding.
bindValue(ref: Ref<string>)voidThe value string follows the ref; an unknown value resolves to index 0 (as in Go).
value()string
setSize(w: float, h: float)void
setEnabled(v: boolean)void

Popover ​

Source: src/widgets/interactive/popover.tks. Extends Component.

ts
new Popover(name: string)

Callback fields: onOpenCb, onCloseCb.

MethodReturnsNotes
setPreferredSide(side: int)void
setContentSize(w: float, h: float)voidThe size of the content area (excluding the title bar).
setTitle(text: string, family: string, size: float)voidAn optional title in the header; family is a registered font family.
setShowCloseButton(v: boolean)void
setContent(comp: Component | null)void
setOnOpen(fn: Function | null)void
setOnClose(fn: Function | null)void
open(trigger: Component | null)voidOpen anchored to trigger, through DEFAULT_POPOVER_MANAGER; another open popover closes first.
close()void
isOpen()boolean
setManager(m: any)voidRemember which manager opened it (PopoverManager.open).

PopoverManager ​

Source: src/widgets/interactive/popover.tks.

Manages the single active floating popover. Use DEFAULT_POPOVER_MANAGER.

MethodReturnsNotes
setScene(s: any)voidCalled on every setScene.
open(p: Popover, trigger: Component | null)voidDisplay p anchored to trigger (null centres it); an open popover closes first.
close(p: Popover)voidClose p if it is the active one.
dismiss()voidThe dismiss node was clicked.
hideActive(fireCallback: boolean)voidRemove the active popover's node tree from the overlay.

RadioButton ​

Source: src/widgets/interactive/radio.tks. Extends Component.

One option within a Radio.

ts
new RadioButton(group: RadioHost, groupName: string, index: int, text: string, family: string, displaySize: float)
MethodReturnsNotes
setSelected(sel: boolean)void
applyThemeColors()void

Radio ​

Source: src/widgets/interactive/radio.tks. Extends Component.

ts
new Radio(name: string)

Callback fields: onChange.

MethodReturnsNotes
setColumns(n: int)voidColumns (default 1 = one vertical stack); triggers a layout update.
setVerticalFirst(v: boolean)voidFill order when columns > 1: false fills left to right then wraps, true fills each column top down.
addOption(text: string, family: string, displaySize: float)RadioButton
setSelected(idx: int)voidProgrammatic selection; does not fire onChange.
bindSelected(ref: Ref<int>)voidThe group follows the ref (initial value applied now); clicks write to it.
selectIndex(idx: int)void

SelectOption ​

Source: src/widgets/interactive/select.tks.

A single choice in a Select.

ts
new SelectOption(label: string, value: any)

Select ​

Source: src/widgets/interactive/select.tks. Extends Component.

ts
new Select(name: string, options: SelectOption[], family: string, displaySize: float)

Callback fields: onChange.

MethodReturnsNotes
setOptions(options: SelectOption[])voidReplace the options; the selection resets to 0.
bindOptions(arr: ReactiveArray<SelectOption> | null)voidThe options follow a ReactiveArray; the selection is clamped. Pass null to detach.
bindSelected(ref: Ref<int>)voidThe selection follows the ref and user choices write to it. Replaces any previous binding.
setSelected(idx: int)voidSelect the option at idx; out of range is ignored.
selectedOption()SelectOption
setOnChange(fn: Function | null)void
setSize(w: float, h: float)voidThe explicit size of the trigger button.
setEnabled(v: boolean)void

Slider ​

Source: src/widgets/interactive/slider.tks. Extends Component.

ts
new Slider(name: string)

Callback fields: onChange.

MethodReturnsNotes
setValue(v: float)void
setRange(mn: float, mx: float)void
setStep(s: float)void
setOrientation(o: int)void
setSize(w: float, h: float)void
bindValue(ref: Ref<float>)voidFollow the ref (initial value applied now); later writes one frame after.
setEnabled(v: boolean)void

TimeValue ​

Source: src/widgets/interactive/timepicker.tks.

A time of day: hour (0-23), minute and second.

ts
new TimeValue(hour: int, minute: int, second: int)

TimeColumn ​

Source: src/widgets/interactive/timepicker.tks.

An up/down stepper column for one time field.

ts
new TimeColumn(container: Node, upBtn: Button, downBtn: Button, label: Quad, labelText: Text)
MethodReturnsNotes
setEnabled(v: boolean)void

TimePicker ​

Source: src/widgets/interactive/timepicker.tks. Extends Component.

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

Callback fields: onTimeChanged.

MethodReturnsNotes
setTime(h: int, m: int, s: int)voidSet the time; h is in the 24h range.
setShowSeconds(v: boolean)void
setFormat(format: int)void
setOnTimeChanged(fn: Function | null)voidCallback (hour24, minute, second) fired when any field changes by user interaction.
bindTime(ref: Ref<TimeValue>)voidThe time follows the ref and user steps write to it.
setSize(w: float, h: float)void
setEnabled(v: boolean)void
setDisplayHour(dispH: int)voidConvert a 12h display hour back to 24h and store it.
toggleAmPm()void

Toggle ​

Source: src/widgets/interactive/toggle.tks. Extends Component.

ts
new Toggle(name: string)

Callback fields: onChange.

MethodReturnsNotes
setValue(v: boolean)void
bindValue(ref: Ref<boolean>)voidFollow the ref (initial value applied now); clicks write to it.
setEnabled(v: boolean)void

ToggleButtonBar ​

Source: src/widgets/interactive/togglebuttonbar.tks. Extends Component.

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

Callback fields: onChange.

MethodReturnsNotes
addButton(label: string)void
removeButton(idx: int)void
setSelected(idx: int)voidOut-of-range indices are ignored; onChange fires only when the index changes.
bindButtons(arr: ReactiveArray<string> | null)voidThe button labels follow a ReactiveArray: the bar is rebuilt on each change, keeping the selection index where possible. Pass null to detach.
bindSelected(ref: Ref<int>)voidThe bar follows the ref (initial value applied now); selections write to it.
setSize(w: float, h: float)void

ToolBar ​

Source: src/widgets/interactive/toolbar.tks. Extends Component.

ts
new ToolBar(name: string)
MethodReturnsNotes
setOrientation(o: int)void
addItem(comp: Component)void
addSeparator()void
addSpacer()void
removeItem(nm: string)voidRemoves the component item with this name (separators and spacers are not matched).
clear()void
setOverflowMode(mode: int)void
setWrap(v: boolean)void
setSize(w: float, h: float)void

ToolGroup ​

Source: src/widgets/interactive/toolgroup.tks.

Callback fields: onChange.

MethodReturnsNotes
setAllowNone(v: boolean)void
add(btn: IconButton)void
setSelected(idx: int)void
bindSelected(ref: Ref<int>)voidThe group follows the ref (initial value applied now); selections write to it.