Reference API Roblox

Engine API

Website

Related

Reference API Roblox

StyleQuery

Instance used to set conditions such as "MaxSize" and "PreferredInput" for a StyleRule.

Member index 12

HistoryMember
726AspectRatioRange: NumberRange
726IsActive: bool
726MaxSize: Vector2
726MinSize: Vector2
726PreferredInput: PreferredInput
726PreferredTextSize: PreferredTextSize
726ReducedMotionEnabled: bool
726ViewportDisplaySize: DisplaySize
699GetCondition(name: string): Variant
699GetConditions(): Dictionary
699SetCondition(name: string, value: Variant): null
699SetConditions(conditions: Dictionary): null
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Removed member index 1

HistoryMember

Description

StyleQuery is an instance used to set conditions like "MaxSize" and "PreferredInput" for a StyleRule. If the conditions are true, the rule's @ selector is enabled. This is helpful to author styling with dynamic container sizes and cross-platform UI.

History 53

Members 12

AspectRatioRange

TypeDefault
NumberRange
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 7

Tags: [NotReplicated, NotScriptable]

GetCondition

Parameters (1)
namestring
Returns (1)
Variant

Returns the value of a specific condition in the StyleQuery.

History 1

GetConditions

Parameters (0)
No parameters.
Returns (1)
Dictionary

Returns a dictionary of key-value pairs describing the conditoins set on the StyleQuery.

History 1

IsActive

TypeDefault
bool

A boolean that determines whether a StyleRule.Selector of @ will match the StyleQuery name. For example, if a StyleQuery named SmGamepad has conditions set for UserInputService.PreferredInput of Gamepad and GuiService.ViewportDisplaySize of Small and both of these conditions are true (player is playing on a small display size and using a gamepad), the parent of the StyleQuery will match any StyleRule.Selector @SmGamepad.

Conditions

ConditionTypeDescription
AspectRatioRangeNumberRangeEvaluates to true if the parent width-to-height ratio of GuiBase2d.AbsoluteSize is greater than or equal to AspectRatioRange.Min and less than AspectRatioRange.Max.
MaxSizeVector2Evaluates to true if the parent GuiBase2d.AbsoluteSize is less than MaxSize.
MinSizeVector2Evaluates to true if the parent GuiBase2d.AbsoluteSize is greater than or equal to MinSize.
PreferredInputPreferredInputEvaluates to true if PreferredInput matches UserInputService.PreferredInput.
PreferredTextSizePreferredTextSizeEvaluates to true if PreferredTextSize matches GuiService.PreferredTextSize.
ReducedMotionEnabledbooleanEvaluates to true if ReducedMotionEnabled matches GuiService.ReducedMotionEnabled.
ViewportDisplaySizeDisplaySizeEvaluates to true if ViewportDisplaySize matches GuiService.ViewportDisplaySize.
This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 3

Tags: [ReadOnly, NotReplicated]

MaxSize

TypeDefault
Vector2
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 7

Tags: [NotReplicated, NotScriptable]

MinSize

TypeDefault
Vector2
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 7

Tags: [NotReplicated, NotScriptable]

PreferredInput

TypeDefault
PreferredInput
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 6

Tags: [NotReplicated, NotScriptable]

PreferredTextSize

TypeDefault
PreferredTextSize
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 2

Tags: [NotReplicated, NotScriptable]

ReducedMotionEnabled

TypeDefault
bool
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 4

Tags: [NotReplicated, NotScriptable]

SetCondition

Parameters (2)
namestring
valueVariant
Returns (1)
null

Sets a new condition (or modifies an existing condition) for the StyleQuery. The name parameter should be a valid condition of StyleQuery, and the assigned value should match the condition's value type, for example Vector2 for MaxSize or PreferredInput for PreferredInput.

Attempts to assign invalid condition names such as "Size" or "Input" will silently fail. Type mismatches such as UDim2 for MaxSize or string for ReducedMotionEnabled will also fail.

To set multiple conditions for a StyleQuery at once, see SetConditions().

1
2
local styleQuery = Instance.new("StyleQuery")
styleQuery:SetCondition("MaxSize", Vector2.new(200, math.huge))

History 1

SetConditions

Parameters (1)
conditionsDictionary
Returns (1)
null

Similar to SetCondition() but lets you declare and set multiple conditions of the StyleQuery at once. Each name parameter should be a valid condition of StyleQuery, and the assigned value should match the condition's value type, for example Vector2 for MaxSize or PreferredInput for PreferredInput.

Attempts to assign invalid condition names such as "Size" or "Input" will silently fail. Type mismatches such as UDim2 for MaxSize or string for ReducedMotionEnabled will also fail.

To set/update just one condition of a StyleQuery, see SetCondition().

1
2
3
4
5
local styleQuery = Instance.new("StyleQuery")
styleQuery:SetConditions({
	["AspectRatioRange"] = NumberRange.new(0, 1),
	["MaxSize"] = Vector2.new(200, math.huge),
})

History 1

ViewportDisplaySize

TypeDefault
DisplaySize
This property is not scriptable. It cannot be accessed by script code.
This property is not replicated. Its interface does not cross the network boundary.

History 6

Tags: [NotReplicated, NotScriptable]

Removed members 1

Settings