Skip to content

Class · inherits UIConstraint

UITextSizeConstraint

Official docs ↗

Ensures that the size of text rendered by certain GuiObject classes lies within the range described by MaxTextSize and MinTextSize.

About UITextSizeConstraint

A UITextSizeConstraint ensures that the size of text rendered by certain GuiObject classes (TextLabel, TextButton, or TextBox) lies within the range described by MaxTextSize and MinTextSize. It is meant to be used alongside TextLabel.TextScaled, which automatically scales text to fill its containing object. Like other UI constraints, it is applied when parented to the object to be constrained.

It's recommended that no values lower than 9 be used for MinTextSize property, otherwise text may not be readable to most users.

Properties 2

  • MaxTextSize: intThe largest size in pixels the font is allowed to be.

    This property indicates the largest size in pixels the font is allowed to be. It defaults to 1000 pixels and must be set larger than or equal to the MinTextSize property.

    If the affected GuiObject has its TextScaled property set to true the text size constrained by this property will scale dynamically with the container's size. It will scale upwards with the GuiObject's size until the max size is reached, at which point it will stay constant if the UI element continues to grow.

  • MinTextSize: intThe smallest size in pixels the font is allowed to be.

    This property indicated the smallest size in pixels the font is allowed to be. This value defaults to 1 pixel and must be set less than or equal to UITextSizeConstraint.MaxTextSize.

    If the affected GuiObject has its TextScaled property set to true the text size constrained by this property will scale dynamically with the container's size. It will scale downwards with the GuiObject's size until the min size is reached, at which point it will stay constant if the UI element continues to shrink.

UITextSizeConstraint also has every member of UIConstraint. Deprecated and Roblox-only members are hidden.

Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.