H3lp Yours3lfDocs
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 collapsible = require 'scripts.s3.components.collapsible'
local text = require 'scripts.s3.components.text'

ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    collapsible {
      title = 'Advanced options',
      expanded = false,
      children = {
        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 · dialog