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
711AspectRatioRange: NumberRange
706IsActive: bool
711MaxSize: Vector2
711MinSize: Vector2
711PreferredInput: PreferredInput
711ReducedMotionEnabled: bool
711ViewportDisplaySize: DisplaySize
699GetCondition(name: string): Variant
699GetConditions(): Dictionary
699SetCondition(name: string, value: Variant): null
699SetConditions(conditions: Dictionary): null
inherited from Instance
553Archivable: bool
670Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
702PredictionMode: PredictionMode
670Sandboxed: bool
680UniqueId: 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
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

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 43

Members 12

AspectRatioRange

TypeDefault
NumberRange0 inf
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]

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
boolfalse

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.
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 2

Tags: [ReadOnly, NotReplicated]

MaxSize

TypeDefault
Vector2INF, INF
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]

MinSize

TypeDefault
Vector20, 0
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]

PreferredInput

TypeDefault
PreferredInputKeyboardAndMouse
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 5

Tags: [NotReplicated, NotScriptable]

ReducedMotionEnabled

TypeDefault
boolfalse
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 3

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
DisplaySizeSmall
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 5

Tags: [NotReplicated, NotScriptable]

Settings