H3lp Yours3lfDocs
api

tabs

Build a selectable tab strip without owning page content.

Builds a horizontal row of buttons. The selected tab gets its selected button and label properties plus the default [ label ] decoration. It does not create, hide, or update page content.

Example

local ui = require 'openmw.ui'
local column = require 'scripts.s3.components.column'
local tabs = require 'scripts.s3.components.tabs'
local text = require 'scripts.s3.components.text'

local pages = {
  'General',
  'Advanced',
}
local page = text {
  text = pages[1],
}
local element

element = ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    column {
      children = {
        tabs {
          items = pages,
          onSelect = function(_, label)
            page.props.text = 'Showing ' .. label
            element:update()
          end,
        },
        page,
      },
    },
  },
}

Parameters

FieldTypeDescription
itemstableTab labels or value entries.
selectedinteger?Initial selected index.
onSelectfunction?Receives the index and selected item.
buttonPropstable?Base button properties.
selectedPropstable?Properties merged onto the selected button.
labelPropstable?Base label properties.
selectedLabelPropstable?Properties merged onto the selected label.
selectedPrefixstring?Prefix for the selected label.
selectedSuffixstring?Suffix for the selected label.

Common layout fields are documented on the UI Components overview. Page content and durable selection remain caller-owned.

See also

selector · button · window