Skip to content
S3ctor’s S3cret St4sh
api

itemSlot

Display an activatable icon slot with an optional count.

Builds a bordered icon slot with an optional count. The H3 frame renders above the icon, and a supplied props.size fixes the total slot dimensions so icon/count content cannot resize the slot. It does not inspect inventory or query game state. Use onActivate when selecting or using the represented item.

Example

local H3UI = require('openmw.interfaces').H3UI

local potion = H3UI.itemSlot {
    resource = {
        path = 'white',
    },
    count = 4,
    selected = selectedItemId == potionId,
    onActivate = function()
        selectPotion()
        return true
    end,
}

Parameters

FieldTypeDescription
resourceopenmw.ui.TextureResource or openmw.ui.TextureResourceOptionsIcon texture resource or options for one.
countnumber?Optional count rendered over the icon.
selectedboolean?Highlights the slot with the active theme color and exposes selected-state styling to H3UI themes.
onActivatefunction?Runs when the slot is activated.
iconPropstable?Properties for the icon.
countPropstable?Properties for the count label.
templateopenmw.ui.Template?Replaces the default H3UI slot frame.

Common layout fields are documented on the UI Components overview. Count values become text during construction; live inventory changes require an owner update or rebuild.

See also

grid · image · iconButton