Loading
Docs / Components / Selectable Icon Buttons
v1.0.0 JAVA MOD LIBRARY

Selectable Icon Buttons

Icon-first selection tiles with sunken dark-green active frames for visual pickers.

ui.selectableIconButton(...) is built for visual pickers (packs, biomes, templates) where an icon sits above an optional centered label. Unlike selectionButton, tiles do not share borders; at rest they use the steel surface (OreTone.STEEL), and when selected (or disabled) they sink 2px into a dark green frame (OreTone.SELECTED_FACE #1C4A12) with a 4-sided OreTone.SELECTED_STROKE (#3C8527) border and no inner highlight or drop shadow.

Interactive Preview

Selected tile: vanilla (32px / 8*--ore-px gap)

Method Signature (OreUi)

// Height is 26 px when label == null, or 37 px when label is non-null
public void selectableIconButton(int x, int y, int w, String label, String[] icon,
                                 boolean selected, boolean enabled, boolean focused,
                                 String key, String tip, Runnable action)

Parameters

ParameterTypeDescription
x, yintTop-left GUI pixel coordinates.
wintTile width in GUI pixels (height is 37px with label, 26px without).
labelStringOptional label centered 12px below the icon, or null for icon-only.
iconString[]8×8 glyph rows (OreIcon.*.small).
selectedbooleanDraws sunken dark-green frame with 4-sided stroke (faceRing).
enabledbooleanWhen false, locks to sunken frame with 50% text/icon opacity.
focusedbooleanForces the 1px white outer focus ring (automatic on Tab).
keyStringUnique hover transition key ("pick:" + key).
tipStringOptional hover tooltip.
actionRunnableInvoked on click or keyboard activation.

Example

String[] packs = { "Vanilla", "Classic", "Dark" };
String[][] icons = { OreIcon.PACKAGE.small, OreIcon.LANDSCAPE.small, OreIcon.BUNDLE.small };

for (int i = 0; i < packs.length; i++) {
	int idx = i;
	ui.selectableIconButton(x + i * 52, y, 44, packs[i], icons[i],
		selectedPack == i, true, false, "pack:" + i,
		"Select " + packs[i], () -> selectedPack = idx);
}