# This file is automatically generated. Please don't edit it manually. # To submit a bug report on the content, see # https://devforum.roblox.com/c/bug-reports/documentation-issues/72 name: UIAspectRatioConstraint type: class memory_category: Instances summary: | Ensures the parent UI element maintains a particular aspect ratio. description: | The `Class.UIAspectRatioConstraint` enforces a **width‑to‑height** aspect ratio on a `Class.GuiObject` regardless of its core size, even if that size is set as a percentage of its parent. For example, inserting this constraint as a child of a `Class.Frame` and setting the constraint's `Class.UIAspectRatioConstraint.AspectRatio|AspectRatio` property to `2` (`2:1`) keeps the frame's width at twice that of its height. Similarly, setting this constraint's `Class.UIAspectRatioConstraint.AspectRatio|AspectRatio` property to `0.5` (`0.5:1`) keeps the frame's width at half that of its height. Setting this constraint's `Class.UIAspectRatioConstraint.AspectRatio|AspectRatio` to the default of `1` (`1:1`) is a convenient way to prevent non‑proportional scaling/stretching of an `Class.ImageLabel` with a square image asset. Note that when a UI object is under control of both a layout structure such as `Class.UIListLayout` and a `Class.UIAspectRatioConstraint`, the constraint will **override** the layout and control the object's size. code_samples: [] inherits: - UIConstraint descendants: [] tags: [] deprecation_message: '' properties: - name: UIAspectRatioConstraint.AspectRatio summary: | Determines the width-to-height ratio to maintain. description: | This property determines the width‑to‑height ratio to maintain. To flip the ratio to height‑to‑width, take the inverse (divide `1` by the number or raise to the -1st power). This value must be greater than `0`. code_samples: [] type: float tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - UI - name: UIAspectRatioConstraint.AspectType summary: | Determines how the maximum size of the object is limited. description: | This property determines how the maximum size of the object is limited. - When set to `Enum.AspectType.FitWithinMaxSize|FitWithinMaxSize`, the object will be the maximum size possible within its own `Class.GuiBase2d.AbsoluteSize|AbsoluteSize`. - When set to `Enum.AspectType.ScaleWithParentSize|ScaleWithParentSize`, the object's maximum size will be the size of the parent while still maintaining the aspect ratio. code_samples: [] type: AspectType tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - UI - name: UIAspectRatioConstraint.DominantAxis summary: | Determines the axis to use when setting the new size of the object. description: | This property determines which axis to use when setting the new size of the object, assuming it would otherwise exceed the size of the parent. code_samples: [] type: DominantAxis tags: [] deprecation_message: '' security: read: None write: None thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: - UI methods: [] events: [] callbacks: []