-
Notifications
You must be signed in to change notification settings - Fork 0
Feedback
Status indicators, loading states, hints, and notifications.
Read-only progress indicator. Eight overloads cover state-bound vs supplier-bound, with or without a custom label format and / or custom styles.
// State-bound
ProgressBar(State<Double> state, double min, double max)
ProgressBar(state, min, max, DoubleFunction<String> labelFormat)
ProgressBar(state, min, max, Style barStyle, Style fillStyle)
ProgressBar(state, min, max, labelFormat, barStyle, fillStyle)
// Supplier-bound (read-only)
ProgressBar(DoubleSupplier reader, double min, double max)
ProgressBar(reader, min, max, DoubleFunction<String> labelFormat)
ProgressBar(reader, min, max, Style barStyle, Style fillStyle)
ProgressBar(reader, min, max, labelFormat, barStyle, fillStyle)State<Double> downloaded = State.of(0.0);
ProgressBar(downloaded, 0.0, 100.0,
v -> String.format("%.1f / 100 MB", v),
/* bar */ Style.height(20).backgroundColor(0xFF_22_22_22).build(),
/* fill */ Style.backgroundColor(0xFF_00_AA_FF).build());Each frame the bar reads the current value, clamps to [min, max], and draws a fill rect proportional to the progress ratio. The default label format renders "Progression XX%" rounded against the range. Pass null to disable the label.
Indeterminate loading indicator — a circular dot trail that rotates smoothly. Time-local (no global ticker), so a hidden Spinner consumes zero CPU.
Spinner()
Spinner(int size)
Spinner(int size, int dotColor, long periodMs, Style style)Spinner(/* size */ 24);
Spinner(32, 0xFF_00_AA_FF, /* period */ 800, Style.DEFAULT);Defaults: 24 px square, white dots, 800 ms period (one full revolution per period). Eight dots are arranged on the circle; each frame the rotation advances and the trailing dots fade to convey direction.
Placeholder rectangle with a horizontal shimmer sweep, used to indicate loading content of unknown shape.
Skeleton()
Skeleton(int width, int height)
Skeleton(int width, int height, int baseColor, int shimmerColor, long periodMs, Style style)// Default 12 px tall, full width.
Skeleton();
// Avatar-shaped placeholder.
Skeleton(32, 32);
// Custom palette + period.
Skeleton(MATCH_PARENT, 80,
/* base */ 0xFF_2A_2A_2E,
/* shimmer */ 0xFF_44_44_4A,
/* period */ 1400,
Style.borderRadius(4).build());Wraps any child. After the cursor hovers the child for delayMs, a popup with text appears near the cursor and follows it until the cursor leaves. Auto-flips against screen edges so the popup never clips offscreen. Multi-line via \n.
Tooltip(String text, UIComponent child)
Tooltip(String text, UIComponent child, Style tooltipStyle)
Tooltip(String text, UIComponent child, Style tooltipStyle, long delayMs)Tooltip("Save the current screen layout",
Button("Save"),
Style.padding(4, 6)
.backgroundColor(0xEE_15_15_15)
.textColor(WHITE).build(),
/* delayMs */ 500);Default delay is 500 ms. Default tooltip style is a dark, lightly-padded popup. The wrapped child's layout and lifecycle are unchanged — Tooltip only adds the deferred-overlay rendering.
Global notification stack rendered at the top-right of any active UIScreen. Toasts slide in, persist for durationMs, then slide out and fade. Independent of any particular screen — call from anywhere in mod code (the manager forwards off-thread calls onto the render thread).
Toast is a nested static class on Components, so you call it as Components.Toast.info(...) or, with import static org.triggersstudio.moddinglib.client.ui.api.Components.*, just Toast.info(...).
public static final class Toast {
public static void info(String message);
public static void success(String message);
public static void warning(String message);
public static void error(String message);
public static void show(String message, ToastType type, long durationMs);
}import static org.triggersstudio.moddinglib.client.ui.api.Components.*;
import org.triggersstudio.moddinglib.client.ui.toast.ToastType;
Toast.info("Saved");
Toast.error("Connection lost");
Toast.show("Custom 8s toast", ToastType.SUCCESS, 8_000);Defaults: 260 × 44 px, top-right anchored with a 12 px margin and a 6 px gap between stacked toasts. The accent bar color is driven by ToastType (INFO, SUCCESS, WARNING, ERROR).
ToastManager.clear() empties the active stack — useful if you want a clean slate when switching screens. ToastManager.activeCount() reports the queue depth.