Skip to content
S3ctor’s S3cret St4sh
api

searchInput

Build a text search field with an optional clear button.

Builds a row containing a bordered TextEdit named input and, by default, a clear button named clear. OpenMW TextEdit has no placeholder property; provide placeholder-like text separately.

Example

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

local query = ''

local search = H3UI.searchInput {
    value = query,
    clearable = true,
    clearLabel = 'Clear',
    onChange = function(value)
        query = value
    end,
    onCommit = function(value)
        print('Search committed:', value)
    end,
}

Parameters

FieldTypeDescription
valuestring?Initial editor text.
onChangefunction?Receives each text change and clear as ''.
onCommitfunction?Receives the current text when editing focus is released; clearing also commits immediately.
clearableboolean?Shows the clear button; enabled by default.
clearLabelstring?Label for the clear button.
borderedboolean?Draws the active H3UI thin frame around the editor; enabled by default.
inputPropstable?Properties for the nested editor.
inputEventstable?Events for the nested editor.
inputExternaltable?External properties for the nested editor.
templateopenmw.ui.Template?Replaces the nested TextEdit template.

Common layout fields are documented on the UI Components overview. Editor handlers belong in inputEvents; row handlers belong in events. If filtering requires destroying and rebuilding a mounted root, update the query in onChange and rebuild from onCommit, deferred by a tick: a synchronous rebuild inside focus loss destroys the element mid-click and eats the click that released focus. Rebuilding from every text change destroys TextEdit focus.

See also

textInput · numberInput · list