Skip to content
S3ctor’s S3cret St4sh
api

listItem

Build an activatable padded list row with optional right-aligned secondary text.

Builds a padded H3UI list row. Without custom content or children, label creates the primary text and secondary optionally creates a right-aligned secondary value. This covers common Morrowind-style rows such as spell name plus Cost/Chance without forcing every caller to rebuild the same spacer/alignment structure.

Example

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

local spell = H3UI.listItem {
    label = 'Detect Creature',
    secondary = '19/63',
    selected = selectedSpell == 'Detect Creature',
    onActivate = function()
        selectSpell('Detect Creature')
        return true
    end,
}

Parameters

FieldTypeDescription
labelstring?Text for the generated primary label.
secondarystring or number?Right-aligned secondary value. Rows with secondary stretch across their parent by default.
selectedboolean?Marks the row as selected so themes can apply active styling.
onActivatefunction?Runs when the row is activated.
labelPropstable?Properties for the generated primary label.
secondaryPropstable?Properties for the generated secondary text.
contenttable?Custom child content; replaces generated label/secondary content.
childrentable?Custom child layouts when content is absent.
templateopenmw.ui.Template?Replaces the default row template.

Common layout fields are documented on the UI Components overview.

The H3UI style adapter exposes label and secondary slots for the generated text. selected = true is also a selector trait, so themes can distinguish selected rows without application-specific classes.

See also

list · button · text