Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Goldberry

A fast and modern UI toolkit for Java 25. A window is three lines, a screen is a KDL file that reloads while it runs, and the same application ships as a jar on any JDK or as one native binary with GraalVM.

Goldberry is a declarative desktop UI toolkit written in pure Java over a small set of native C libraries, bound through the Foreign Function & Memory API. There is no JNI, no bundled web engine and no wrapping of platform widgets. Widgets are immutable records with a pure build(), or the same tree as KDL markup. They are styled with a real CSS subset and laid out by flexbox. Frames are rasterized on the CPU, and presented through the GPU when the optional GPU module is present. Linux, Windows and macOS are peer platforms behind one backend.

The Goldberry showcase on its Buttons screen: every button variant, badges and chips, each card with a link to its section of this guideThe Goldberry showcase on its Buttons screen: every button variant, badges and chips, each card with a link to its section of this guide

The showcase's Buttons screen. Every card shows one section of this guide and links to it.

Where to start

The shape of an application

A model is plain Java. A screen is markup that names the model’s values and actions. A stylesheet gives the screen its look. The application class joins the three and owns the window.

@Model
public final class Settings {
    @Bind("app.gain") private Number gain = 40;

    @Actions
    public record Commands(Settings values) {
        @Action("app.set-gain") public void setGain(double gain) { values.gain = gain; }
    }
}
column id="settings" {
  text class="heading" "Volume"
  slider min=0 max=100 step=5 bind="app.gain" change="app.set-gain"
}
public final class Hello implements Application {

    private final Settings settings = new Settings();
    private final Settings.Commands actions = new Settings.Commands(settings);

    @Override public List<Object> models() { return List.of(settings, actions); }

    @Override public Widget root() {
        return Widgets.inflater(actions, settings)
                .inflate(KdlParser.resource(Hello.class, "settings.kdl").getFirst());
    }

    @Override public List<Stylesheet> stylesheets() {
        return Controls.stylesheets(Theme.NORD_DARK);
    }

    public static void main(String[] args) {
        Goldberry.launch(new Hello(), args);
    }
}

Moving the slider calls setGain. Assigning the field notifies the slider and asks the window for a frame. Nothing in the application repaints, subscribes or registers a listener. Building an application explains each part.

Status

This guide covers Goldberry 2026.3. See the changelog for changes and migration steps.

Important

There is no screen-reader support on any platform. The rest of the accessibility baseline is in place: keyboard reachability, a focus ring, WCAG AA contrast, hit targets, reduced motion and text scale. Limitations lists the rest.

About this book

The guide has six parts. The decision log on GitHub is the project’s memory: one record per significant choice, with the forces, the alternatives and the costs. Every page has an edit this page link to its source on GitHub.