Builds an H3UI button with a centered row containing an image and, optionally, a label. Pass a texture resource or texture options for the icon.
Example
local async = require 'openmw.async'
local ui = require 'openmw.ui'
local iconButton = require 'scripts.s3.components.iconButton'
ui.create {
type = ui.TYPE.Container,
layer = 'Windows',
content = ui.content {
iconButton {
label = 'Map',
resource = {
path = 'white',
},
events = {
mouseClick = async:callback(function()
print('Map pressed')
return true
end),
},
},
},
}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. |
iconProps | table? | Properties for the icon. |
labelProps | table? | Properties for the label. |
template | openmw.ui.Template? | Replaces the default H3UI button template. |
Common layout fields are documented on the UI Components overview. Wrap OpenMW callbacks with async:callback.