Open Asterune
UDim

UDim

Combines parent-relative scale and pixel offset for one axis.

Behavior

UDim stores a scale and offset. A resolved measurement is the parent dimension multiplied by Scale, plus Offset pixels. Two UDim values form a UDim2.

Summary

Constructors1
Functions1
  • UDim.new(scale: number?, offset: number?): UDim

    Creates a dimension from scale and offset, in that order.

Members2
Properties2
  • Offset: numberread only

    The pixel offset added to the scaled dimension.

  • Scale: numberread only

    The fraction of the parent dimension.

Constructors

new

UDim.new(scale: number?, offset: number?): UDim

Creates a dimension from scale and offset, in that order.

Properties

Offset

UDim.Offset: number

The pixel offset added to the scaled dimension. Read-only.

Scale

UDim.Scale: number

The fraction of the parent dimension. Read-only.

Operators

__add · __eq · __sub · __tostring · __type

Example

Luau
local halfWithPadding = UDim.new(0.5, -8)

Used by

Stack · UICorner · UIListLayout · UIPadding

UDim2 · Frame · Vector2