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

Buttons

Tactile push buttons and stacked icon buttons with five semantic variants, eight interaction states, and Tab focus support.

ui.button(...) and ui.buttonStacked(...) render the primary layered Ore UI push buttons. At rest each button shows 2px shadow rows under the face; while pressed, the face sinks 3px and the shadow rows collapse to 0. All button methods return void and invoke a Runnable callback on click or Enter/Space when focused.

Interactive Playground

Clicks: 0

Click any control above then press Tab to move the white focus ring across buttons.

Design Guidelines

  • Hierarchy: Use OreVariant.COLORED once per screen or modal for the primary CTA; pair it with OreVariant.GENERAL for secondary or cancel actions.
  • Content Modes: Supports text-only, leading 8×8 icon (OreIcon.*.small) + text (ui.button), stacked icon above text (ui.buttonStacked), and icon-only (label = null).
  • Subtle vs. Full Disabled: Pass enabled = false, subtlyDisabled = true when the variant hue still provides context (e.g., pagination boundary arrows). Pass enabled = false (or subtlyDisabled = false) for neutral grey disabled buttons.

Content & Orientation

Layout
Colored
General
Destructive
Warning
Realms
Text
Text & Icon
Icon Only
Vertical

All 8 States

State
Colored
General
Destructive
Warning
Realms
Default
Hovered
Focused
Focused + Hover
Pressed
Pressed + Hover
Subtly Disabled
Disabled

Method Signatures (OreUi)

// Default height (OreUi.BUTTON_HEIGHT = 26), text-only, enabled
public void button(int x, int y, int w, String label, OreVariant variant, String tip, Runnable action)

// Custom height, text-only, enabled
public void button(int x, int y, int w, int h, String label, OreVariant variant, String tip, Runnable action)

// Custom height, optional 8x8 icon, enabled and focused state
public void button(int x, int y, int w, int h, String label, String[] icon,
                   OreVariant variant, String tip, Runnable action,
                   boolean enabled, boolean focused)

// Supports subtlyDisabled (variant hue at 50% content alpha, flat shadow)
public void button(int x, int y, int w, int h, String label, String[] icon,
                   OreVariant variant, String tip, Runnable action,
                   boolean enabled, boolean subtlyDisabled, boolean focused)

// Stacked button: 8x8 icon centered above the label (recommended h >= 34)
public void buttonStacked(int x, int y, int w, int h, String label, String[] icon,
                          OreVariant variant, String tip, Runnable action,
                          boolean enabled, boolean focused)

Overloads accepting (boolean textShadow, int textShadowColor, Boolean iconShadowOverride) are also available for both button and buttonStacked.

Parameters

ParameterTypeDefault / ConstantDescription
x, yint—Top-left GUI pixel coordinates.
w, hinth = OreUi.BUTTON_HEIGHT (26)Width and height in GUI pixels.
labelStringnull allowedButton text; pass null for an icon-only square button.
iconString[]null8×8 glyph rows (e.g. OreIcon.PLAY.small), or null for text-only.
variantOreVariant—Semantic surface palette (COLORED, GENERAL, WARNING, DESTRUCTIVE, REALMS).
tipStringnull allowedOptional hover tooltip string.
actionRunnable—Invoked on click release or keyboard activation.
enabledbooleantrueEnables hit-testing, Tab focus, and hover/press states.
subtlyDisabledbooleanfalseWhen !enabled, keeps variant hue at 50% content opacity instead of grey fill.
focusedbooleanfalseForces the 1px white outer focus ring (automatic on Tab navigation).

Example

// Primary CTA with leading 8x8 icon
ui.button(x, y, 120, OreUi.BUTTON_HEIGHT, "Play World", OreIcon.PLAY.small,
	OreVariant.COLORED, "Launch selected world", this::startGame, true, false);

// Stacked icon + label toolbar button
ui.buttonStacked(x + 128, y, 64, 36, "Export", OreIcon.EXPORT.small,
	OreVariant.GENERAL, "Export settings", this::exportSettings, true, false);

// Subtly disabled button
ui.button(x, y + 42, 100, OreUi.BUTTON_HEIGHT, "Continue", null,
	OreVariant.COLORED, null, () -> {}, false, true, false);