Skip to content

Display 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.

AnimatedImage ​

Source: src/widgets/display/animatedimage.tks. Extends Component.

ts
new AnimatedImage(name: string)

Callback fields: onFrameChanged, onComplete.

MethodReturnsNotes
setAtlas(tex: Texture | null, fw: int, fh: int)voidSlice an atlas texture into frames of fw by fh, left to right then top to bottom.
setFrames(frames: TextureRegion[])voidAn explicit list of regions as frames.
loadGif(g: GifData | null)voidFrames and per-frame delays from a decoded GIF; loop count 0 loops forever, otherwise once.
loadGifBytes(bytes: Buffer)voidDecode raw GIF file bytes (throws on a malformed file) and load them.
setFPS(fps: float)void
setPlayMode(mode: int)void
play()void
pause()void
stop()void
setFrame(n: int)void
currentFrame()int
isPlaying()boolean
setScaleMode(mode: int)void
setTint(c: Color)void
setCornerRadius(r: float)void-1 is a full pill.
setSize(w: float, h: float)void

Badge ​

Source: src/widgets/display/badge.tks. Extends Component.

ts
new Badge(name: string, family: string, displaySize: float)
MethodReturnsNotes
text()string
setText(t: string)void
setCount(n: int)voidThe count as text, "N+" above maxCount (0 disables truncation).
setMaxCount(n: int)void
setDotMode(v: boolean)void
setPadding(top: float, right: float, bottom: float, left: float)voidOverride the theme padding with per-instance values.
setSize(w: float, h: float)voidOverride the auto-size dimensions.
sizeToContent()voidFit the badge to its content plus padding (dot mode: the theme dot size, default 8).

MeterBar ​

Source: src/widgets/display/progressbar.tks. Extends Component.

ts
new MeterBar(name: string)
MethodReturnsNotes
value()floatThe current normalized fill value (0 to 1), regardless of range.
setRange(min: float, max: float)void
setValue(v: float)voidSet the value in [min, max], mapped to 0..1 internally.
setProgress(v: float)voidSet the normalized 0..1 fill directly, bypassing the range (used by bindValue).
setSize(w: float, h: float)void
setShowLabel(show: boolean, family: string, displaySize: float)voidShow or hide the percentage label overlay (created on first show).
bindValue(ref: Ref&lt;float&gt;)voidFollow a Ref<float> (0..1 normalized): applied now and at every later write.
setFillColor(c: Color)void
clearFillColor()void

ProgressBar ​

Source: src/widgets/display/progressbar.tks. Extends MeterBar.

ProgressBar is an alias for MeterBar (Go type alias).

ts
new ProgressBar(name: string)

LineFragment ​

Source: src/widgets/display/richtext.tks.

A piece of text on a line, from a single span, with resolved styling and measured size.

ts
new LineFragment(color: Color)

LinkRect ​

Source: src/widgets/display/richtext.tks.

A clickable region mapped during render.

ts
new LinkRect(rect: Rect, url: string)

RichText ​

Source: src/widgets/display/richtext.tks. Extends Component.

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

Callback fields: onLinkClick.

MethodReturnsNotes
setHeadingScale(h1: float, h2: float, h3: float)void
addSpan(text: string)RichText
addStyledSpan(text: string, family: string | null, color: Color, outline: Outline | null)RichTextA span with explicit styling; the colour is always set. family and outline null inherit.
addTextSpan(span: TextSpan)RichText
addBoldSpan(text: string, color: Color)RichText
addItalicSpan(text: string, color: Color)RichText
addBoldItalicSpan(text: string, color: Color)RichText
clearSpans()RichText
setSpans(spans: TextSpan[])RichText
setWrapWidth(w: float)void
setAlign(a: int)void
setColor(c: Color)void
setOutline(o: Outline | null)void
setMarkup(markup: string)voidParse XML-like markup and replace all spans. Throws on an unknown tag.

Spacer ​

Source: src/widgets/display/spacer.tks. Extends Component.

ts
new Spacer(name: string, w: float, h: float)
MethodReturnsNotes
setSize(w: float, h: float)voidComponent.setSize also keeps an established hit shape in step; a spacer has none.

StatAxis ​

Source: src/widgets/display/statweb.tks.

ts
new StatAxis(name: string, min: float, max: float, value: float)

StatWeb ​

Source: src/widgets/display/statweb.tks. Extends Component.

ts
new StatWeb(name: string, family: string, fontSize: float)

Callback fields: onValueChanged.

MethodReturnsNotes
setAxes(axes: StatAxis[])voidDefine all spokes at once (at most eight; values are clamped into each axis's range).
setValues(values: float[])voidBulk-set values by index, parallel to the axes.
values()float[]
setValue(index: int, value: float)void
value(index: int)float
setFillEnabled(v: boolean)voidShow or hide the semi-transparent polygon fill.
setEditable(v: boolean)void
isEditable()boolean
setSize(w: float, h: float)void

ToastEntry ​

Source: src/widgets/display/toast.tks.

ts
new ToastEntry(root: Component, progressNode: Quad | null, progressMaxW: float, w: float, h: float, cfg: ToastOptions)
MethodReturnsNotes
cancelAnim()void
cancelTimers()voidDrop the expiry and progress entries from the ticker.

ToastManager ​

Source: src/widgets/display/toast.tks.

MethodReturnsNotes
setFont(family: string, size: float)voidFont used to render messages; call once at startup. An empty family draws no message.
setAnchor(corner: int)void
setMaxStack(n: int)voidMaximum toasts visible at once (default 4, minimum 1); the oldest is dropped when full.
setMargin(x: float, y: float)voidPixel gap between the stack and the screen edge (default 16 by 16).
show(message: string, variant: int, opts?: Function[])voidShow a toast; opts are option functions from withDuration and friends.
dismissAll()voidRemove every toast immediately, running each onDismiss.
setScene(s: any)voidScene change: drop every entry and rebuild the overlay under the new root.
dismissEntry(e: ToastEntry)voidBegin the dismiss animation (click-to-dismiss).