Skip to content
S3ctor’s S3cret St4sh
api

iconButton

Build a framed button with an icon and optional label.

Builds an H3UI button with an icon and optional label. Use onActivate for the ordinary click action.

Example

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

local mapButton = H3UI.iconButton {
    label = 'Map',
    resource = {
        path = 'textures/menu_icon_magic.dds',
    },
    selected = currentMode == 'map',
    onActivate = openMap,
}

Parameters

FieldTypeDescription
resourceopenmw.ui.TextureResource or openmw.ui.TextureResourceOptionsIcon texture resource or options for one.
labelstring?Optional text beside the icon.
selectedboolean?Highlights the button with the active theme color and exposes selected-state styling to H3UI themes.
onActivatefunction?Runs for the normal button activation.
iconPropstable?Properties for the icon.
labelPropstable?Properties for the label.
templateopenmw.ui.Template?Replaces the default H3UI button frame.

Common layout fields are documented on the UI Components overview. Raw events remain available for behavior outside the normal activation contract.

See also

button · image · itemSlot