H3lp Yours3lfDocs
api

spacer

Add fixed space or flexible empty room to a layout.

Builds an empty ui.TYPE.Widget. Use spacer(8) for an 8×8 square, spacer(12, 4) for width and height, or an options table for full control.

Example

local ui = require 'openmw.ui'
local util = require 'openmw.util'
local row = require 'scripts.s3.components.row'
local spacer = require 'scripts.s3.components.spacer'
local text = require 'scripts.s3.components.text'

ui.create {
  type = ui.TYPE.Container,
  layer = 'Windows',
  content = ui.content {
    row {
      props = {
        size = util.vector2(240, 24),
      },
      children = {
        text {
          text = 'Left',
        },
        spacer {
          grow = 1,
        },
        text {
          text = 'Right',
        },
      },
    },
  },
}

Parameters

FieldTypeDescription
widthnumberWidth for numeric shorthand.
heightnumber?Height for numeric shorthand; defaults to width.
grownumber?Flexible growth when external is absent.
stretchnumber?Flexible stretch when external is absent.

The table form also accepts common layout fields, documented on the UI Components overview. A growing spacer needs remaining space from its parent; give the row an explicit size or place it in a larger fixed-size layout.

See also

row · column · widget