Skip to content

UI

The UI namespace provides methods to show notifications, toast messages and input dialogs to the player.

Required permission: ui

Import

typescript
import { UI } from "@hotbunny/hackhub-content-sdk";

Methods

UI.notify(message)

Show a notification popup to the player. Appears as a system-style notification.

ParameterTypeDescription
messagestringNotification text
typescript
UI.notify("New quest available!");
UI.notify("You received a file from an unknown sender.");

UI.toast(message, type?)

Show a brief toast message at the bottom of the screen.

ParameterTypeDescription
messagestringToast message text
type"success" | "error" | "warning" | "info"Toast style (optional, defaults to info)
typescript
UI.toast("File downloaded successfully", "success");
UI.toast("Connection failed", "error");
UI.toast("Low disk space", "warning");
UI.toast("Scanning network...", "info");

UI.prompt(options?)

Ask the player for a line of text. Resolves with what they typed, or null when they cancel.

Where it asks depends on the caller. Inside a mod command the player is already typing in a terminal, so the question is asked there. Anywhere else (quest code, a mod app) it opens a dialog.

OptionTypeDescription
titlestringHeading of the dialog (optional)
labelstringLabel shown above the input (optional)
placeholderstringPlaceholder text (optional)
passwordbooleanMasks the input, for passphrases and keys (optional)
defaultValuestringValue the input starts with (optional)
typescript
const key = await UI.prompt({ label: "WPA passphrase:", password: true });
if (key) await Network.connectWifi("HOME_5Ghz", key);

HotBunny Interactive Entertainment Inc.