Skip to content

SusHotbar

SusHotbar

Inventory shortcut strip — N slots with key labels, selection chrome, digits 1…N / arrows / Enter.

Package

SusGame · HUD (commercial)

Open in Playground

SusGame · HUD

Props

NameTypeDefault
SlotCountProp<int>6
SelectedIndexProp<int>0
CooldownStyleProp<string>"Radial"

Slots

No slots.

Events

NameFieldPayload
SlotActivatedOnSlotActivatedint
SelectionChangedOnSelectionChangedint

Style hooks

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

  • sus-hotbar
  • sus-hotbar__cd-wipe
  • sus-hotbar__icon
  • sus-hotbar__icon-host
  • sus-hotbar__key
  • sus-hotbar__slot
  • sus-hotbar__slot--selected
  • sus-hotbar__title

Usage

csharp
var bar = new SusHotbar();
bar.SlotCount.Value = 6;
bar.SelectedIndex.Value = 0;
bar.OnSlotActivated += i => { /* use item */ };
bar.OnSelectionChanged += i => { /* highlight */ };

bar.SetSlotIcon(0, "potion");
bar.SetSlotLabel(0, "Heal");
bar.SetSlotIcon(1, "bomb");
bar.SetSlotLabel(1, "Grenade");
xml
<template>
  <sus:SusHotbar :SlotCount="Slots.Value"
                 :SelectedIndex="Selected.Value"
                 @slot-activated="OnSlotActivated"
                 @selection-changed="OnSelectionChanged" />
</template>

<script>
public Prop<int> Slots = new(6);
public Prop<int> Selected = new(0);
void OnSlotActivated(int index) { /* … */ }
void OnSelectionChanged(int index) { /* … */ }
// Call SetSlotIcon / SetSlotLabel after mount (slots rebuild on SlotCount).
</script>
Prop / APIRole
SlotCountSlots 1…10 (default 6)
SelectedIndexSelected slot (visual + keyboard)
SetSlotIcon(i, name)Icon for slot
SetSlotLabel(i, text)Title under icon
OnSlotActivatedClick / digit / Enter
OnSelectionChangedSelection moved

Notes

  • Slots rebuild when SlotCount changes — set icons/labels after rebuild/mount.
  • Keyboard: digits 1…N, Home/End, arrows (roving focus), Space/Enter activate.
  • For combat abilities prefer SusAbilityBar; hotbar is the inventory shortcut contract.