Skip to content

Your first window

A storage screen with a search field, a filtered list and two buttons. You describe it, Galdur UI lays it out: no coordinates, no sizes.

⏱ 6 minGaldur UI 0.1.0Client
Before you start

You need a mod for Minecraft 1.21.1 and NeoForge 21.1 (Java 21), with Galdur UI as a dependency. If that's not done yet, follow Installation.

Create the window

Everything starts with GaldurLib.createWindow(). It returns an empty window.

StorageScreen.java
GaldurWindow window = GaldurLib.createWindow();window.addTitle(Component.literal("Storage"), true);   // true = centred

Elements are stacked top to bottom, in the order you add them. Theme, spacing and size are handled for you.

Add a search field and a list

Every add… method returns a handle. A ListHandle holds the lines and the selected line, and you can change them while the window is open.

StorageScreen.java
List<String> ores = List.of("Coal", "Iron", "Copper", "Gold");SearchHandle search = window.addSearch(Component.literal("Search..."));ListHandle list = window.addList(4);   // 4 lines visiblelist.setLines(ores.stream().<Component>map(Component::literal).toList());search.onChange(text -> list.setLines(ores.stream()        .filter(ore -> ore.toLowerCase().contains(text.toLowerCase()))        .<Component>map(Component::literal).toList()));

To react when the player picks a line, use onSelect. When the lines are replaced, the selection is cleared and onSelect receives -1.

Add buttons in a row

By default, elements go one below the other. addRow puts them side by side. Here the row is centred.

StorageScreen.java
RowHandle buttons = window.addRow(true);buttons.addButton(Component.literal("Take"), () -> take(list.getSelected()));buttons.addButton(Component.literal("Close"), window::close);

Open it

window.open() shows the window on the next client tick. Escape or window.close() go back to the screen that was open before. Try it:

Storage
Coal
Iron
Copper
Gold
Live preview of the code above. Type in the field, pick a line.
Client only

Windows, widgets, screens and the theme are client-only. Only api.menu loads on a dedicated server: open windows from client code (a key mapping, a client command), never from server code.

Everything you can add

Each method below also has an overload with a final boolean centered parameter. Rows accept text, buttons, icon buttons and checkboxes.

MethodReturnsAdds
addTitle(text)ElementHandleA title, in the Fredoka title font.
addText(text)ElementHandleA line of text.
addButton(label, action)ElementHandleA button. The action runs on click and on Enter.
addIconButton(icon, label, action)ElementHandleA button with an item or a sprite. The label becomes the tooltip.
addCheckbox(label, checked)CheckboxHandleA checkbox, with its state and onChange.
addRow()RowHandleElements side by side.
addList(visibleRows)ListHandleA scrolling list with a selection.
addSearch(placeholder)SearchHandleA text field, with onChange on every key.
addProgress(label)ProgressHandleA progress bar, from 0 to 1 or done / total.
addTabs()TabsHandleTabs, each with its own content. Window only.

Every handle can also disable, hide or give a tooltip to its element: see Handles.

© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.