Layout
Layout instances with friendly, reactive arguments: padding, corner, stroke, list, grid, flex, gradient, aspectRatio, sizeConstraint, textSizeConstraint. Each is flat on Flux.
Flux.new "Frame" { Flux.list { gap = 8, align = "center" }, Flux.corner(12) }Types
Length type
type Length = number | UDimReactiveLength type
type ReactiveLength = Reactive<number> | Reactive<UDim>Insets type
type Insets = { top: number?, bottom: number?, left: number?, right: number? }Align type
type Align = "start" | "center" | "end"FlexAlign type
type FlexAlign = Align | "between" | "around" | "evenly" | "stretch" | "fill" | "none"LineAlign type
type LineAlign = Align | "stretch" | "automatic"Direction type
type Direction = "x" | "y"FlexMode type
type FlexMode = "fill" | "grow" | "shrink" | "none"PaddingSides type
type PaddingSides = {
top: ReactiveLength?,
bottom: ReactiveLength?,
left: ReactiveLength?,
right: ReactiveLength?,
x: ReactiveLength?,
y: ReactiveLength?,
}ListConfig type
type ListConfig = {
gap: ReactiveLength?,
direction: Reactive<Direction | Enum.FillDirection>?,
align: Reactive<FlexAlign>?,
justify: Reactive<FlexAlign>?,
horizontalAlign: Reactive<FlexAlign | Enum.HorizontalAlignment | Enum.UIFlexAlignment>?,
verticalAlign: Reactive<FlexAlign | Enum.VerticalAlignment | Enum.UIFlexAlignment>?,
lineAlign: Reactive<LineAlign | Enum.ItemLineAlignment>?,
wraps: Reactive<boolean>?,
}GridConfig type
type GridConfig = {
cell: Reactive<number | Vector2 | UDim2>?,
gap: Reactive<number | Vector2 | UDim2>?,
fill: Reactive<Direction | Enum.FillDirection>?,
align: Reactive<Align | Enum.HorizontalAlignment>?,
justify: Reactive<Align | Enum.VerticalAlignment>?,
maxCells: Reactive<number>?,
}StrokeConfig type
type StrokeConfig = {
thickness: Reactive<number>?,
color: Reactive<Color3>?,
transparency: Reactive<number>?,
mode: Reactive<"contextual" | "border" | Enum.ApplyStrokeMode>?,
joins: Reactive<"round" | "bevel" | "miter" | Enum.LineJoinMode>?,
position: Reactive<"inner" | "center" | "outer" | Enum.BorderStrokePosition>?,
offset: Reactive<number | UDim>?,
}CornerSides type
type CornerSides = {
radius: ReactiveLength?,
topLeft: ReactiveLength?,
topRight: ReactiveLength?,
bottomLeft: ReactiveLength?,
bottomRight: ReactiveLength?,
top: ReactiveLength?,
bottom: ReactiveLength?,
left: ReactiveLength?,
right: ReactiveLength?,
}GradientConfig type
type GradientConfig = {
color: Reactive<Color3 | ColorSequence | { Color3 }>?,
transparency: Reactive<number | NumberSequence | { number }>?,
rotation: Reactive<number>?,
offset: Reactive<Vector2>?,
enabled: Reactive<boolean>?,
}SizeConstraintConfig type
type SizeConstraintConfig = {
min: Reactive<Vector2>?,
max: Reactive<Vector2>?,
minWidth: Reactive<number>?,
minHeight: Reactive<number>?,
maxWidth: Reactive<number>?,
maxHeight: Reactive<number>?,
}TextSizeConstraintConfig type
type TextSizeConstraintConfig = {
min: Reactive<number>?,
max: Reactive<number>?,
}Functions
padding
Layout.padding(value: Length | PaddingSides | Graph.Node<any> | (() -> Length | Insets)): UIPaddingCreates a UIPadding from a single length, a { top, bottom, left, right, x, y } table, or a reactive source. Plain number values are interpreted as offset pixels.
corner
Layout.corner(radius: ReactiveLength | CornerSides?): UICornerCreates a UICorner from an offset pixel radius, a UDim, or a per-corner { topLeft, topRight, bottomLeft, bottomRight, top, bottom, left, right, radius } table.
stroke
Layout.stroke(config: StrokeConfig?): UIStrokeCreates a UIStroke with static or reactive thickness, color, transparency, mode, joins, position, and offset.
aspectRatio
Layout.aspectRatio(ratio: Reactive<number>, aspectType: Reactive<"fit" | "scale" | Enum.AspectType>?, dominantAxis: Reactive<"width" | "height" | Enum.DominantAxis>?): UIAspectRatioConstraintCreates a UIAspectRatioConstraint with ratio, aspectType ("fit" or "scale"), and dominantAxis ("width" or "height").
list
Layout.list(config: ListConfig?): UIListLayoutCreates a UIListLayout with SortOrder = LayoutOrder and flexbox-style gap, direction, align (cross-axis), justify (main-axis), and wraps options.
grid
Layout.grid(config: GridConfig?): UIGridLayoutCreates a UIGridLayout with SortOrder = LayoutOrder and cell, gap, fill, align, justify, and maxCells options.
flex
Layout.flex(mode: Reactive<FlexMode | Enum.UIFlexMode>?): UIFlexItemCreates a UIFlexItem with mode ("fill" by default, "grow", "shrink", or "none").
gradient
Layout.gradient(config: GradientConfig?): UIGradientCreates a UIGradient from single values, evenly spaced stop arrays, or sequences for color and transparency.
sizeConstraint
Layout.sizeConstraint(config: SizeConstraintConfig?): UISizeConstraintCreates a UISizeConstraint from min/max Vector2 bounds or per-axis minWidth, minHeight, maxWidth, and maxHeight bounds.
textSizeConstraint
Layout.textSizeConstraint(config: TextSizeConstraintConfig?): UITextSizeConstraintCreates a UITextSizeConstraint bounding text size between min and max pixels.