Skip to content

StyleBox

Global · StyleBox · server and client scripts

StyleBox creates an immutable visual style for UI panels, frames, and controls combining background color, border, corner radius, padding, and optional nine-slice image. To read fields on a style box, see StyleBox.

new

Function
new(init: StyleBoxInit) -> StyleBox

StyleBox.new creates a StyleBox from an options table with optional Color, BorderColor, BorderWidth, CornerRadius, Padding, Image, and Slice fields. Unknown keys raise an error.

Example

-- Client script.
local card = StyleBox.new({
    Color = Color.fromRGB(32, 36, 44),
    BorderColor = Color.fromRGB(80, 90, 110),
    BorderWidth = 1,
    CornerRadius = 8,
    Padding = Insets.all(12),
})
print(card.CornerRadius, card.Padding.Left) -- prints 8 12