Skip to content

Class · inherits Instance

StyleQuery

Official docs ↗

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

Methods 4

  • GetCondition(name: string) → VariantReturns the value of a specific condition in the StyleQuery.
  • GetConditions() → DictionaryReturns a dictionary of key-value pairs describing the conditoins set on the StyleQuery.
  • SetCondition(name: string, value: Variant) → ()

    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().

  • SetConditions(conditions: Dictionary) → ()Lets you declare and set multiple conditions of the StyleQuery at once.

    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().

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.