Style Modifiers Reference

Sizing

MacroDescriptionExample
w(n)Fixed widthw(200)
h(n)Fixed heighth(100)
w_fillFill parent widthw_fill
h_fillFill parent heighth_fill
w_fitFit content widthw_fit
h_fitFit content heighth_fit
minW(n)Minimum widthminW(100)
maxW(n)Maximum widthmaxW(500)
minH(n)Minimum heightminH(50)
maxH(n)Maximum heightmaxH(300)

Further reference for sizing styling

Spacing

MacroDescriptionExample
m(n)Margin (all sides)m(10)
mx(n)Margin horizontalmx(15)
my(n)Margin verticalmy(10)
mt/mr/mb/ml(n)Individual marginsmt(5)
p(n)Padding (all sides)p(20)
px(n)Padding horizontalpx(15)
py(n)Padding verticalpy(10)
pt/pr/pb/pl(n)Individual paddingpt(5)

Further reference for margin and padding styling

Borders

MacroDescriptionExample
b(n)Border width (all sides)b(2)
bx(n)Border width horizontalbx(2)
by(n)Border width verticalby(2)
bt/bb/bl/br(n)Individual border widthsbt(1)
borderColour(r,g,b)Border colourborderColour(80,80,80)
borderColour(r,g,b,a)Border colour with alphaborderColour(80,80,80,180)

This is border width — for corner radius, see Visual below.

Further reference for border styling

Colors

MacroDescriptionExample
bg(r,g,b)Background colorbg(45,45,45)
bg(r,g,b,a)Background with alphabg(45,45,45,200)
textColour(r,g,b)Text colortextColour(255,255,255)
rgb(r,g,b)Color helperbg(rgb(45,45,45))
rgba(r,g,b,a)RGBA helperbg(rgba(45,45,45,200))
inheritBg(bool)Inherit background from parent instead of the theme defaultinheritBg(false)

Further reference for colour styling, and Theming for where these colours can come from

Layout

MacroDescriptionExample
up_downChildren top→bottomup_down
down_upChildren bottom→topdown_up
left_rightChildren left→rightleft_right
right_leftChildren right→leftright_left
centerXCenter horizontallycenterX
centerYCenter verticallycenterY
centerXYCenter both axescenterXY
clipChildrenClip children that overflow this element (alias: overflow_hidden)clipChildren

Further reference for layout directions and centering

Text

MacroDescriptionExample
fontSize(n)Font size in pixelsfontSize(16)
lineHeight(n)Line height multiplierlineHeight(1.5)
justify_leftAlign text leftjustify_left
justify_centerCenter textjustify_center
justify_rightAlign text rightjustify_right
textWrap(bool)Enable/disable wrappingtextWrap(false)

Further reference for text-based properties

Visual

MacroDescriptionExample
rounded(n)Border radius, all cornersrounded(8)
roundedTL/TR/BL/BR(n)Radius on a single cornerroundedTL(8)
roundedTop/Bottom/Left/Right(n)Radius on both corners of one edgeroundedTop(8)
absolutePos(x,y)Absolute positionabsolutePos(100,50)

[!WARNING] Absolute positioning can mess up the layout tree significantly. For most use cases that require absolute positioning, it is recomended you use them with a CustomTargetQueue which is seperate to the default element tree. You can find out more about it in Advanced Topics and can view documented implmentations of specific use cases like that require absolute positioning and custom render targets like modals.

Identification

MacroDescriptionExample
id(str)Assign an id to an element, for lookup later via GetElementByIdid("Submit")

Component Sizing

These only affect SableUI's built-in components (Button, Checkbox, etc.) — they have no effect on a plain Div, Text, or Rect.

MacroDescriptionExample
size_smSmall component sizingsize_sm
size_mdMedium component sizing (default)size_md
size_lgLarge component sizingsize_lg
size_noneDisable automatic sizing/padding entirelysize_none
disabled(bool)Disable a componentdisabled(true)

Further reference for how each built-in component uses these





Card image

Styling Guide

In-depth guide for all style modifiers

Card image

Theming

Theme, ThemeManager, and where bg/textColour defaults come from

Card image

Components

Button, Checkbox, TextField, DatePicker, and Calendar