Package me.hackware.api.gui
Class Button
java.lang.Object
me.hackware.api.gui.Button
A nextui-style button (JoshMerlino/nextui
Button.tsx, dense size):
rounded-md, sentence-case label, centred both axes.
- raised — solid accent fill, hover darkens (600 → 700), light label, soft shadow.
- outlined — accent text,
accent/501px outline, transparent body, hoveraccent/10tint.
Ripple on press.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDense button height (nextuih-7proportioned to the MC font).static final intLarge button height (nextuih-11 px-6 text-base).static final intGap between a leading icon and the label.static final intnextui dark-mode neutral (neutral-300) — outlined-neutral text/border/ripple.static final intHorizontal label padding for the dense variant.static final intHorizontal label padding forHEIGHT_LARGEbuttons (nextuipx-3). -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voiddraw(UiContext ui, int x, int y, int w, int h, Icons.Icon icon, int iconSize, String label, boolean primary) draw(me.hackware.api.gui.UiContext, int, int, int, int, me.hackware.api.gui.Icons.Icon, int, java.lang.String, int)with a leading tinted icon; icon + label are centred as one group.static voiddraw(UiContext ui, int x, int y, int w, int h, Icons.Icon icon, int iconSize, String label, int contentColor) Outlined icon + label button tinted to an arbitrarycontentColor(border, hover tint, icon and label) instead of the accent — e.g.static voiddrawNeutral(UiContext ui, int x, int y, int w, int h, String label) nextui outlined-neutral variant:text-neutral-300,border-neutral-300/50, hoverbg-neutral-300/10.static voiddrawNeutral(UiContext ui, int x, int y, int w, int h, String label, float alpha) drawNeutral(me.hackware.api.gui.UiContext, int, int, int, int, java.lang.String)faded byalpha(0..1) — for a host animating the surface the button sits on (e.g.static intradius()Corner radius used by the button surfaces (so callers can match a ripple's clip).static intContent-hugging width for a label (w-min+ dense padding).static intContent-hugging width for a leading icon + label.static intwidthForLarge(UiContext ui, String label) widthFor(me.hackware.api.gui.UiContext, java.lang.String)for aHEIGHT_LARGEbutton — the wider inset.
-
Field Details
-
HEIGHT
public static final int HEIGHTDense button height (nextuih-7proportioned to the MC font).- See Also:
-
HEIGHT_LARGE
public static final int HEIGHT_LARGELarge button height (nextuih-11 px-6 text-base).- See Also:
-
PAD_H
public static final int PAD_HHorizontal label padding for the dense variant. Tighter than the large variant's: the MC font is narrow and these buttons are short, so the wider inset left them reading as stretched pills rather than content-hugging controls.- See Also:
-
PAD_H_LARGE
public static final int PAD_H_LARGEHorizontal label padding forHEIGHT_LARGEbuttons (nextuipx-3).- See Also:
-
ICON_GAP
public static final int ICON_GAPGap between a leading icon and the label.- See Also:
-
NEUTRAL
public static final int NEUTRALnextui dark-mode neutral (neutral-300) — outlined-neutral text/border/ripple.- See Also:
-
-
Method Details
-
widthFor
Content-hugging width for a label (w-min+ dense padding). -
widthForLarge
widthFor(me.hackware.api.gui.UiContext, java.lang.String)for aHEIGHT_LARGEbutton — the wider inset. -
widthFor
Content-hugging width for a leading icon + label. -
drawNeutral
nextui outlined-neutral variant:text-neutral-300,border-neutral-300/50, hoverbg-neutral-300/10. -
drawNeutral
drawNeutral(me.hackware.api.gui.UiContext, int, int, int, int, java.lang.String)faded byalpha(0..1) — for a host animating the surface the button sits on (e.g. a confirm dialog popping in / out). At1fthis is identical to the plain overload; a faded button also stops reacting to hover, since a fading dialog no longer takes input. -
radius
public static int radius()Corner radius used by the button surfaces (so callers can match a ripple's clip). -
draw
public static void draw(UiContext ui, int x, int y, int w, int h, Icons.Icon icon, int iconSize, String label, int contentColor) Outlined icon + label button tinted to an arbitrarycontentColor(border, hover tint, icon and label) instead of the accent — e.g. a muted / secondary-text refresh action. -
draw
public static void draw(UiContext ui, int x, int y, int w, int h, Icons.Icon icon, int iconSize, String label, boolean primary) draw(me.hackware.api.gui.UiContext, int, int, int, int, me.hackware.api.gui.Icons.Icon, int, java.lang.String, int)with a leading tinted icon; icon + label are centred as one group. -
draw
-