Skip to main content

Styling Props

Styling props are globally supported props for styling UI. These aim to stay close to Roblox's way of doing things, but differ when necessary, most notably in children-based styling.

Property-based styling

Traditional GuiObject properties like BackgroundColor3 are supported identically to how Roblox does it. Use these as you would normally. There are exceptions however, like how Color is preferred over BackgroundColor3 in Button.

Children-based styling

UIPaddings, UIStrokes, UIListLayouts... Children-based styling is just too much boilerplate. In OnyxUI, all components support an extensive set of props to avoid working with these objects. See references below:

Basics

Roblox 🤓OnyxUI 😎
UICornerCornerRadius
UIPaddingPadding, PaddingTop, PaddingLeft, PaddingRight, PaddingBottom
UIStrokeStrokeEnabled, StrokeThickness, StrokeColor, StrokeTransparency, StrokeLineJoinMode, StrokeApplyStrokeMode
UIGradientGradientEnabled, GradientColor, GradientOffset, GradientRotation, GradientTransparency

Layouts

Roblox 🤓OnyxUI 😎
UIFlexItemFlexMode, FlexItemLineAlignment, FlexGrowRatio, FlexShrinkRatio
UIListLayoutListEnabled, ListPadding, ListFillDirection, ListSortOrder, ListWraps, ListHorizontalAlignment, ListHorizontalFlex, ListVerticalAlignment, ListVerticalFlex, ListItemLineAlignment
UIGridLayoutGridEnabled, GridFillDirection, GridFillDirectionMaxCells, GridCellPadding, GridCellSize, GridSortOrder, GridStartCorner, GridHorizontalAlignment, GridVerticalAlignment

For other layouts like UITableLayout and UIPageLayout, see the Base component's source code.

Constraints

Roblox 🤓OnyxUI 😎
UIAspectRatioConstraintAspectRatio, AspectType, DominantAxis
UISizeConstraintMaxSize, MinSize
UITextSizeConstraintMaxTextSize, MinTextSize

Use in custom components

To support styling props in your own components, make use of the CombineProps utility to pass props through automatically. Your component must be based upon an OnyxUI component such as Base for this to work.