Skip to content
S3ctor’s S3cret St4sh
api

collapsible

Build an expandable disclosure header and body.

Builds a vertical column containing a header button and body column. Body visibility follows expanded, which defaults to false.

Example

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

ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    H3UI.collapsible {
      title = 'Advanced options',
      expanded = false,
      children = {
        H3UI.text {
          text = 'These options are currently visible.',
        },
      },
      onToggle = function(expanded)
        print('Expanded:', expanded)
      end,
    },
  },
}

Parameters

FieldTypeDescription
titlestringHeader text.
expandedboolean?Initial body visibility; defaults to false.
onTogglefunction?Receives the new expanded state.
contenttable?Body content; takes precedence over children.
childrentable?Body layouts used when content is absent.
headerPropstable?Properties for the header button.
headerLabelPropstable?Properties for the header label.
expandedPrefixstring?Prefix for the expanded header.
collapsedPrefixstring?Prefix for the collapsed header.

Common layout fields are documented on the UI Components overview. Call the owning element's update() when the mounted tree needs refreshing.

See also

toggle · column