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
| Field | Type | Description |
|---|---|---|
resource | openmw.ui.TextureResource or openmw.ui.TextureResourceOptions | Icon texture resource or options for one. |
label | string? | Optional text beside the icon. |
selected | boolean? | Highlights the button with the active theme color and exposes selected-state styling to H3UI themes. |
onActivate | function? | Runs for the normal button activation. |
iconProps | table? | Properties for the icon. |
labelProps | table? | Properties for the label. |
template | openmw.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.