TopMenuSheetDocs / API / Modules / topmenu
TopMenu
Admin & chat@s2script/sdk/topmenu
Shared admin/top-menu registry. Plugins declare a tab with addTab({ id, title }) then addItem(tabId, item). Items default to the admin sheet (sm_admin); opt into the player hub (sm_menu) with sheets: ["menu"]. Snapshot tabs is { id, title }[]; categories stays tab ids.
Import
import { TopMenuSheet } from "@s2script/sdk/topmenu";Author-time types ship in the npm package; the engine injects the runtime at plugin load.
Add @s2script/sdk to your plugin's dependencies.
API reference
Generated from the shipped type definitions.
TopMenuTabA plugin-owned dashboard tab. id is the TopMenuItem grouping key (addItem first
argument); title is what the hub paints on the tab bar.
TopMenuItemA single registered top-menu entry (an admin command surfaced in the adminmenu).
TopMenuSnapshotA handler-free copy of the whole registry — what a menu renderer reads to build the display.
TopMenuThe shared admin/top-menu registry — renderers read TopMenu.snapshot and dispatch picks
through TopMenu.select; items are contributed by plugins via topmenu.
import { TopMenu } from "@s2script/sdk/topmenu";
const snap = TopMenu.snapshot();
for (const cat of snap.categories) renderCategory(cat);
// when the admin picks an item id, dispatch it back to its owner plugin:
m.onSelect(e => { TopMenu.select(e.info, slot); });