SusInventoryTabBar

Grid-tab strip — one tab per InventoryGridDef, click switches ActiveGridId, hover supports drag-over tab change.
Package
SusGame · Inventory (commercial)
SusGame · Inventory
Props
No public props.
Slots
No slots.
Events
| Name | Field | Payload |
|---|---|---|
GridChanged | OnGridChanged | string |
TabHover | OnTabHover | string |
Style hooks
USS class contract — override appearance without touching C#. States toggle via these classes:
sus-inventory-tabbarsus-inventory-tabbar__tabsus-inventory-tabbar__tab--activesus-inventory-tabbar__tab-iconsus-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 / API | Role |
|---|---|
GridDefs | Tabs source (Id, Name, optional Icon) |
ActiveGridId | Selected tab (USS --active) |
RebuildTabs() | Clear + rebuild tab buttons |
OnGridChanged | Click → new grid id |
OnTabHover | Pointer enter (drag-over) |
Notes
- Current
SusInventorybag 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.Iconrenders a smallSusIconbefore the label. - Prefer Session
SetActiveGrid/OnTabChangedwhen the shell owns switching.