Class · inherits Instance
StyleQuery
Instance used to set conditions such as "MaxSize" and "PreferredInput" for
a StyleRule.
About StyleQuery
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.
Properties 1
IsActive
: booleanReadOnlyNotReplicatedA boolean that determines whether aStyleRule.Selectorof@will match theStyleQueryname.A boolean that determines whether a
StyleRule.Selectorof@will match theStyleQueryname. For example, if aStyleQuerynamedSmGamepadhas conditions set forUserInputService.PreferredInputofGamepadandGuiService.ViewportDisplaySizeofSmalland both of these conditions aretrue(player is playing on a small display size and using a gamepad), the parent of theStyleQuerywill match anyStyleRule.Selector@SmGamepad.Conditions
Methods 4
GetCondition
(name: string) → VariantReturns the value of a specific condition in theStyleQuery.GetConditions
() → DictionaryReturns a dictionary of key-value pairs describing the conditoins set on theStyleQuery.SetCondition
(name: string, value: Variant) → ()Sets a new condition (or modifies an existing condition) for the
StyleQuery. Thenameparameter should be a valid condition ofStyleQuery, and the assigned value should match the condition's value type, for exampleVector2forMaxSizeorPreferredInputforPreferredInput.Attempts to assign invalid condition names such as
"Size"or"Input"will silently fail. Type mismatches such asUDim2forMaxSizeorstringforReducedMotionEnabledwill also fail.To set multiple conditions for a
StyleQueryat once, seeSetConditions().SetConditions
(conditions: Dictionary) → ()Lets you declare and set multiple conditions of theStyleQueryat once.Similar to
SetCondition()but lets you declare and set multiple conditions of theStyleQueryat once. Eachnameparameter should be a valid condition ofStyleQuery, and the assigned value should match the condition's value type, for exampleVector2forMaxSizeorPreferredInputforPreferredInput.Attempts to assign invalid condition names such as
"Size"or"Input"will silently fail. Type mismatches such asUDim2forMaxSizeorstringforReducedMotionEnabledwill also fail.To set/update just one condition of a
StyleQuery, seeSetCondition().
StyleQuery also has every member of Instance. 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.