Skip to content

SusInventoryTabBar

SusInventoryTabBar

Grid-tab strip — one tab per InventoryGridDef, click switches ActiveGridId, hover supports drag-over tab change.

Package

SusGame · Inventory (commercial)

Open in Playground

SusGame · Inventory

Props

No public props.

Slots

No slots.

Events

NameFieldPayload
GridChangedOnGridChangedstring
TabHoverOnTabHoverstring

Style hooks

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-inventory-tabbar
  • sus-inventory-tabbar__tab
  • sus-inventory-tabbar__tab--active
  • sus-inventory-tabbar__tab-icon
  • sus-inventory-tabbar__tab-label

Usage

List-driven: assign GridDefs, set ActiveGridId, call RebuildTabs (Mounted also rebuilds). Wire into a custom shell when you need explicit bag tabs.

csharp
var tabs = new SusInventoryTabBar();
tabs.GridDefs = new List<InventoryGridDef>
{
    new() { Id = "bag", Name = "Backpack", Icon = "backpack", Width = 10, Height = 8 },
    new() { Id = "loot", Name = "Loot", Icon = "chest", Width = 6, Height = 4 },
};
tabs.ActiveGridId = "bag";
tabs.OnGridChanged += id => { /* SusInventory.SetActiveGrid(id) */ };
tabs.OnTabHover += id => { /* drag-over switch */ };
tabs.RebuildTabs();
xml
<template>
  <sus:SusInventoryTabBar />
</template>

<script>
// No Prop<> — fill GridDefs / ActiveGridId from C#, then RebuildTabs.
void OnGridChanged(string gridId) { /* … */ }
void OnTabHover(string gridId) { /* … */ }
</script>
Prop / APIRole
GridDefsTabs source (Id, Name, optional Icon)
ActiveGridIdSelected tab (USS --active)
RebuildTabs()Clear + rebuild tab buttons
OnGridChangedClick → new grid id
OnTabHoverPointer enter (drag-over)

Notes

  • Current SusInventory bag layout uses dual grids (main + secondary by SortOrder) — no tabs in the template. TabBarHost (.sus-inventory__tabs) may be null; mount this bar yourself if you need multi-bag tabs.
  • Optional def.Icon renders a small SusIcon before the label.
  • Prefer Session SetActiveGrid / OnTabChanged when the shell owns switching.