Skip to content

willowui ​

Illustration: blank wooden and glass game menus, buttons and sliders drifting like lanterns among the trees at dusk

willowui is the UI toolkit for ThicketScript: buttons, labels, text input, lists, trees, tables, windows, menus, tooltips, toasts, color and date pickers, and more. It lays widgets out for you, styles them with themes, keeps them in step with your data through reactive refs, and can build a whole screen from an XML template.

It is written entirely in ThicketScript on top of willow, the 2D module, and it ships as a package that your project lists.

A wooden UI window with a list, a slider, a checkbox, a toggle, a text field and buttons
Illustration

A first screen ​

This is a complete window app: a label that counts and a button that adds one.

ts
import { Button, DEFAULT_STAGE, Label, Ref, Screen } from "willowui";

const screen: Screen = new Screen();
const clicks: Ref<int> = new Ref<int>(0);
const text: Ref<string> = new Ref<string>("Clicks: 0");

const label: Label = new Label("count", "", "default", 24.0);
label.bindText(text);
label.setPosition(24.0, 24.0);
screen.add(label);

const button: Button = new Button("add", "Click me", "default", 16.0);
button.setSize(140.0, 40.0);
button.setPosition(24.0, 80.0);
button.setOnClick((): void => {
    clicks.set(clicks.peek() + 1);
    text.set("Clicks: " + clicks.peek());
});
screen.add(button);

DEFAULT_STAGE.setScene(engine.root2d);
DEFAULT_STAGE.add(screen);
App.onFrame((dt: float): void => {
    DEFAULT_STAGE.update(dt);
});

The same screen as an XML template:

xml
<Panel layout="vbox" spacing="12" padding="20">
    <Label bind:text="'Clicks: ' + clicks" fontSize="24" />
    <Button text="Click me" on:click="add" />
</Panel>

XML templates shows the controller that supplies clicks and add.

Where to go next ​

If you want toRead
Add willowui to a project and open a windowGetting started
Understand screens, the stage and componentsConcepts
Arrange widgets in rows, columns, grids and anchorsLayout
Build screens from XMLXML templates
Look up a widgetWidget catalogue
Style with variants and themesVariants and inline themes
Get typed input back into your dataRecipe: a form

What is in the box ​

FamilyWidgets
CoreComponent, Panel, Label, Button, IconButton, Image, Tooltip, ScrollBar, ScrollPanel
DisplayBadge, ProgressBar, MeterBar, RichText, AnimatedImage, StatWeb, Toast, Spacer
InteractiveToggle, Checkbox, Radio, Slider, Select, OptionRotator, ToggleButtonBar, MenuBar, ContextMenu, Popover, ToolBar, DragHandle, TimePicker, CalendarSelector, KeybindInput, ImageCropper
TextTextInput, TextArea, MaskedInput, InputField, SearchBox, NumberStepper, Tag, TagBar, ColorPicker
ContainersWindow, TabBar, List, TileList, TreeList, SortableList, SortableTreeList, TreeTable, Accordion, NavDrawer, AnchorLayout, TwoColumnLayout
CompositesDataTable, GradientEditor

Status ​

willowui is a port of an earlier Go library, and some files and comments in its source still say so. The pages here describe what the code does today; where a feature is partial, the page says so.