Skip to content

Utility tags ​

Utility tags are the core idea of Tilly, allowing you to apply complex styling with minimal markup. Let's break it down.

Utility tags contain several components: a prefix, the value it ingests, and optionally variants and an exclamation mark. The formatting is like so: {variants}:{prefix}-{value}{!}.

Value types ​

Values are passed into utility tags to give them form, like how the bg prefix accepts tokens in the color namespace. Values can be of the following types, depending on the utility tag's prefix.

FormResolves toExamples
Token value{namespace}-{value}rounded-lg → radius-lg
Multiplierbase {namespace} token × the number (integer or decimal)p-4 → 4 × 4, p-0.5 → 0.5 × 4, opacity-50 → 50 / 100
pxthe {namespace}-px token if there is one, else base × 1p-px → spacing-px (1)
None (one-part tag){namespace}-defaultborder → border-default
Subtokens{namespace}-{value}--{subtoken}-1 for each subtokenshadow-lg → shadow-lg--offset-1, shadow-lg--blur-1, …

Variants ​

Variants make utility tags conditional, so the tag applies when the variant target is met.

VariantTargetsPriorityExamples
hover:Enum.GuiState.Hover state+10hover:bg-red-400
active:Enum.GuiState.Press state+10active:bg-red-600
disabled:Enum.GuiState.NonInteractable state+10disabled:opacity-50
*:Child instances+10*:p-2
**:Descendant instances+10**:text-white

Importance ​

By appending an exclamation mark ! to the end of your tag, you give it priority to win out against other tags. This can be useful in resolving styling conflicts.

Prefixes ​

Prefixes can be thought of as the "root" of a utility tag, defining its purpose and the properties it sets.

Background ​

PrefixNamespaces, in orderSetsExamples
bgcolor → objectBackgroundColor3 (+ BackgroundTransparency = 0); ScaleTypebg-red-500, bg-cover
opacityopacityTransparencyopacity-50
objectobjectScaleTypeobject-contain

Typography ​

PrefixNamespaces, in orderSetsExamples
texttext → color → text-align → text-wrapped → text-truncateTextSize; TextColor3; TextXAlignment; TextWrapped; TextTruncatetext-lg, text-red-500, text-center, text-wrap, text-ellipsis
fontfont → font-weightFontFace.Family; FontFace.Weightfont-mono, font-bold
leadingleadingLineHeightleading-tight
alignalignTextYAlignmentalign-middle
truncatetext-truncateTextTruncatetruncate, truncate-clip
whitespacewhitespaceTextWrappedwhitespace-nowrap

Border and shadow ​

PrefixNamespaces, in orderSetsExamples
borderborder → colorUIStroke.Thickness; UIStroke.Colorborder, border-2, border-red-500
shadowshadow → colorUIShadow.Enabled, or Offset, BlurRadius, Spread, Color, Transparency from subtokens; UIShadow.Colorshadow-lg, shadow-none, shadow-black

Corner radius ​

Every rounded* prefix uses only radius and sets UICorner properties. Logical prefixes assume LTR.

PrefixNamespaces, in orderSetsExamples
roundedradiusTopLeftRadius, TopRightRadius, BottomRightRadius, BottomLeftRadiusrounded-lg, rounded-full
rounded-tradiusTopLeftRadius, TopRightRadiusrounded-t-md
rounded-rradiusTopRightRadius, BottomRightRadiusrounded-r-md
rounded-bradiusBottomRightRadius, BottomLeftRadiusrounded-b-md
rounded-lradiusTopLeftRadius, BottomLeftRadiusrounded-l-md
rounded-tlradiusTopLeftRadiusrounded-tl-xl
rounded-trradiusTopRightRadiusrounded-tr-xl
rounded-brradiusBottomRightRadiusrounded-br-xl
rounded-blradiusBottomLeftRadiusrounded-bl-xl
rounded-sradiusTopLeftRadius, BottomLeftRadiusrounded-s-lg
rounded-eradiusTopRightRadius, BottomRightRadiusrounded-e-lg
rounded-ssradiusTopLeftRadiusrounded-ss-sm
rounded-seradiusTopRightRadiusrounded-se-sm
rounded-eeradiusBottomRightRadiusrounded-ee-sm
rounded-esradiusBottomLeftRadiusrounded-es-sm

Padding and gap ​

Logical prefixes assume LTR.

PrefixNamespaces, in orderSetsExamples
pspacingUIPadding.PaddingTop, PaddingRight, PaddingBottom, PaddingLeftp-4, p-px
pxspacingUIPadding.PaddingLeft, PaddingRightpx-6
pyspacingUIPadding.PaddingTop, PaddingBottompy-2
ptspacingUIPadding.PaddingToppt-1
prspacingUIPadding.PaddingRightpr-1
pbspacingUIPadding.PaddingBottompb-1
plspacingUIPadding.PaddingLeftpl-1
psspacingUIPadding.PaddingLeftps-3
pespacingUIPadding.PaddingRightpe-3
pbsspacingUIPadding.PaddingToppbs-3
pbespacingUIPadding.PaddingBottompbe-3
gapspacingUIListLayout.Paddinggap-2
gap-xspacingUIListLayout.Paddinggap-x-2
gap-yspacingUIListLayout.Paddinggap-y-2

Sizing ​

Logical prefixes assume a horizontal writing mode.

PrefixNamespaces, in orderSetsExamples
wspacing → container → fractionSize.Xw-8, w-md, w-full
hspacing → fractionSize.Yh-8, h-full
sizespacing → fractionSizesize-10, size-full
min-wspacing → containerUISizeConstraint.MinSize.Xmin-w-16, min-w-sm
min-hspacingUISizeConstraint.MinSize.Ymin-h-16
max-wspacing → containerUISizeConstraint.MaxSize.Xmax-w-lg
max-hspacingUISizeConstraint.MaxSize.Ymax-h-64
inlinespacing → containerSize.Xinline-8, inline-md
blockspacingSize.Yblock-8
min-inlinespacing → containerUISizeConstraint.MinSize.Xmin-inline-sm
min-blockspacingUISizeConstraint.MinSize.Ymin-block-16
max-inlinespacing → containerUISizeConstraint.MaxSize.Xmax-inline-lg
max-blockspacingUISizeConstraint.MaxSize.Ymax-block-64
aspectaspectUIAspectRatioConstraint.AspectRatioaspect-video, aspect-2
autoautomatic-sizeAutomaticSizeauto-xy

Position and transform ​

Logical prefixes assume LTR.

PrefixNamespaces, in orderSetsExamples
insetspacingPositioninset-4
inset-xspacingPosition.Xinset-x-4
inset-yspacingPosition.Yinset-y-4
topspacingPosition.Ytop-2
leftspacingPosition.Xleft-2
inset-sspacingPosition.Xinset-s-2
inset-bsspacingPosition.Yinset-bs-2
translatespacingPositiontranslate-2
translate-xspacingPosition.Xtranslate-x-2
translate-yspacingPosition.Ytranslate-y-2
scalescaleUIScale.Scalescale-150, scale-none
rotaterotateRotationrotate-45

Image and scrolling ​

PrefixNamespaces, in orderSetsExamples
fillcolorImageColor3fill-white
strokecolorImageColor3stroke-white
scrollbar-thumbcolorScrollBarImageColor3scrollbar-thumb-zinc-500

Layout ​

PrefixNamespaces, in orderSetsExamples
flexfill-direction → flex-wrap → flex-modeUIListLayout.FillDirection; UIListLayout.Wraps; UIFlexItem.FlexModeflex, flex-col, flex-wrap, flex-1
gridfill-directionUIGridLayout.FillDirectiongrid, grid-col
grid-flowfill-directionUIGridLayout.FillDirectiongrid-flow-col
grid-colsmax-cellsUIGridLayout.FillDirectionMaxCells (+ FillDirection = Horizontal)grid-cols-3
grid-rowsmax-cellsUIGridLayout.FillDirectionMaxCells (+ FillDirection = Vertical)grid-rows-2
growgrowUIFlexItem.FlexMode = Growgrow
shrinkshrinkUIFlexItem.FlexMode = Shrinkshrink
justifyhorizontal-alignment → flex-alignmentUIListLayout.HorizontalAlignment (+ HorizontalFlex = None); UIListLayout.HorizontalFlexjustify-center, justify-between
contentvertical-alignment → flex-alignmentUIListLayout.VerticalAlignment (+ VerticalFlex = None); UIListLayout.VerticalFlexcontent-end, content-evenly
place-contentplace-content-start → place-content-center → place-content-end → flex-alignmentUIListLayout.HorizontalAlignment (+ matching VerticalAlignment, both flexes None), once per alignment; UIListLayout.HorizontalFlex, VerticalFlexplace-content-center, place-content-between
itemsitem-alignmentUIListLayout.ItemLineAlignmentitems-center
place-itemsitem-alignmentUIListLayout.ItemLineAlignmentplace-items-center
selfitem-alignmentUIFlexItem.ItemLineAlignmentself-end
place-selfitem-alignmentUIFlexItem.ItemLineAlignmentplace-self-end
orderorderLayoutOrderorder-2, order-first
zzZIndexz-10

Visibility and interaction ​

PrefixNamespaces, in orderSetsExamples
hiddenhiddenVisible = falsehidden
visiblevisibleVisible = truevisible
overflowoverflowClipsDescendantsoverflow-hidden, overflow-visible
pointer-eventspointer-eventsInteractablepointer-events-none

Transitions ​

These set the default transition (*), which applies to every property.

PrefixNamespaces, in orderSetsExamples
transitiondurationTweenInfo.Timetransition, transition-300
durationdurationTweenInfo.Timeduration-300, duration-none
easeeaseTweenInfo.EasingStyle + EasingDirectionease, ease-out
delaydelayTweenInfo.DelayTimedelay-150