H3lp Yours3lfDocs
api

pinButton

Build the fixed-size Morrowind pinned-state control.

Builds the vanilla up/down pin control. It is fixed at 19×19 pixels and changes its skin when clicked.

Example

local ui = require 'openmw.ui'
local pinButton = require 'scripts.s3.components.pinButton'

local pinned = false
local element

element = ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    pinButton {
      pinned = pinned,
      onToggle = function(value)
        pinned = value
        print('Pinned:', value)
        element:update()
      end,
    },
  },
}

Parameters

FieldTypeDescription
pinnedboolean?Initial pin state; defaults to false.
onTogglefunction?Receives the new pin state.

Common layout fields are documented on the UI Components overview. A supplied props.size must be exactly 19×19. The component does not update the mounted element or persist the pin state.

See also

caption · window · toggle