H3lp Yours3lfDocs
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 ui = require 'openmw.ui'
local searchInput = require 'scripts.s3.components.searchInput'

local query = ''
local element

element = ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    searchInput {
      value = query,
      clearable = true,
      clearLabel = 'Clear',
      onChange = function(value)
        query = value
        print('Search:', query)
        element:update()
      end,
    },
  },
}

Parameters

FieldTypeDescription
valuestring?Initial editor text.
onChangefunction?Receives text changes and clear as ''.
clearableboolean?Shows the clear button; enabled by default.
clearLabelstring?Label for the clear button.
borderedboolean?Draws top, left, and bottom borders 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 default row template.

Common layout fields are documented on the UI Components overview. Editor handlers belong in inputEvents; row handlers belong in events.

See also

textInput · numberInput · list