Skip to content
S3ctor’s S3cret St4sh
api

button

Build an H3UI text button with a semantic activation callback.

Builds a framed H3UI text button. label creates the default text child; custom content or children replaces it. Prefer onActivate for the normal click action and use raw events only for additional OpenMW event behavior.

Example

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

local deleteButton = H3UI.button {
    label = 'Delete',
    tone = 'negative',
    onActivate = function()
        deleteSelected()
        return true
    end,
}

Parameters

FieldTypeDescription
labelstring?Text for the generated button label.
onActivatefunction?Runs for the normal button activation.
labelPropstable?Properties for the generated label.
contenttable?Custom content; replaces the generated label.
childrentable?Custom child layouts when content is absent.
templateopenmw.ui.Template?Replaces the default H3UI button frame.

Common layout fields are documented on the UI Components overview. If both events.mouseClick and onActivate are present, H3 composes them rather than discarding the caller event.

See also

toggle · iconButton