Skip to content

Tabs

A tab row splits a window into pages. Each tab is filled like a window, and the window keeps the size of the largest tab so nothing jumps when the player switches.

⏱ 4 minGaldur UI 0.1.0Client

Add tabs

addTabs() adds a tab row and returns a TabsHandle. Each addTab() returns a TabHandle, filled with the same add… methods as a window.

TerminalScreen.java
TabsHandle tabs = window.addTabs(true);   // true = centredTabHandle storage = tabs.addTab(Component.literal("Storage"));storage.addSearch(Component.literal("Search..."));storage.addList(6);TabHandle crafting = tabs.addTab(Component.literal("Crafting"));crafting.addText(Component.literal("3 × 3 grid"));

The first tab added starts active. Only the active tab's content is shown, below the row.

Window only

Tabs are added to the window, not inside a tab: a tab does not contain another tab row.

Switch tabs from code

TerminalScreen.java
tabs.onSelect(index -> System.out.println("Tab: " + index));crafting.select();          // same as tabs.setSelected(1)

onSelect is called whenever the active tab really changes, whether the player clicked or your code called setSelected. The new content replaces the old one on the next frame.

A "Next tab" button, for instance:

TerminalScreen.java
RowHandle actions = window.addRow(true);actions.addButton(Component.literal("Next tab"),        () -> tabs.setSelected((tabs.getSelected() + 1) % tabs.getTabs().size()));

State is kept

The state lives in the handles, not in the shown widgets: the active tab survives resizes, and each tab's content (search text, list scroll…) is kept when switching tabs.

Handles of a hidden tab stay usable at any time. A change in a hidden tab shows when the player comes back, so a checkbox in one tab can enable a button in another:

TerminalScreen.java
CheckboxHandle advanced = autocraft.addCheckbox(Component.literal("Advanced mode"), false);advanced.onChange(options::setEnabled);   // "options" lives in the Storage tab

Size and layout

The window keeps the size of the largest tab content, so it does not resize when switching tabs. Tab content slides in from its side when the player switches (unless animations are off, see Animations).

The tab row itself is an element like any other: disable it to lock the current tab, hide it to remove the row and all its content, or give it a tooltip:

TerminalScreen.java
tabs.setTooltip(Component.literal("Left and right arrows switch tabs"));
© 2026 Galdur Studio · galdurstudio.com · Discord · LGPL-3.0-onlyNot an official Minecraft product. Not approved by or associated with Mojang or Microsoft.