Skip to content

GaldurTabs

classclient onlysince 1.0.0

com.galdurstudio.galdurui.api.widget.GaldurTabs

Themed row of tabs, usable in vanilla layouts. The player switches tab with a click, or with the left and right arrows.

Like GaldurScrollList, the widget does not keep the active tab: it reads it every frame from a supplier and reports the tab the player picks. Showing the matching content is up to the caller; in a GaldurWindow, addTabs() does it.

Example.java
List<Component> titles = List.of(Component.literal("Storage"), Component.literal("Crafting"));int[] active = {0};column.addChild(GaldurTabs.of(titles, () -> active[0], index -> active[0] = index));
  • Active tab: tab_selected sprite tinted accent, joined to the bottom line of the same colour.
  • Other tabs: lower, tab sprite tinted surface, text_muted text; the tint moves towards the accent on hover.
  • Keyboard: left and right arrows while the row has focus; the active tab is then outlined in accent_hover.
  • Disabled (active = false): muted colours, no click or arrows.

Sizes from the theme: spacing.tab_height and spacing.tab_padding_x. The width can exceed the tabs' (see of()): the bottom line then runs the full width and the tabs stay on the left.

public class GaldurTabs extends AbstractWidget
PACKAGEapi.widget
SIDEclient only
EXTENDSAbstractWidget

Constructors 1

GaldurTabs

protected
protected GaldurTabs(int width, List<Component> titles, IntSupplier selected, IntConsumer onSelect)

Prefer of().

PARAMETERS

widthintwanted width, in pixels; never less than the tabs'
titlesList<Component>tab titles, in order; the list is copied
selectedIntSuppliersupplier of the active tab index, called every frame
onSelectIntConsumercalled with the index of the tab the player picks

Methods 4

of

static2 overloads
public static GaldurTabs of(List<Component> titles, IntSupplier selected, IntConsumer onSelect)
public static GaldurTabs of(int width, List<Component> titles, IntSupplier selected, IntConsumer onSelect)

PARAMETERS

titlesList<Component>tab titles, in order; the list is copied
selectedIntSuppliersupplier of the active tab index, called every frame
onSelectIntConsumercalled with the index of the tab the player picks
widthintminimum width, in pixels

RETURNSGaldurTabs — a tab row just wide enough for its titles, at (0, 0) for a layout to place

preferredWidth

static
public static int preferredWidth(List<Component> titles)

PARAMETERS

titlesList<Component>the tab titles

RETURNSint — the width that shows all tabs side by side, gaps included

getTitles

public List<Component> getTitles()

RETURNSList<Component> — the tab titles, read-only

clicked

protected
protected boolean clicked(double mouseX, double mouseY)

Only a click on a tab counts: no sound or focus on the line or the empty space.

PARAMETERS

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