StyleQuery
Instance used to set conditions such as "MaxSize" and "PreferredInput" for
a StyleRule.
| Memory category | Instances |
|---|
Member index 12
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
- 713 Change Tags of StyleQuery from [NotBrowsable] to []
- 711 Change ReadSecurity of ViewportDisplaySize from None to RobloxSecurity
- 711 Change ReadSecurity of ReducedMotionEnabled from None to RobloxSecurity
- 711 Change ReadSecurity of PreferredInput from None to RobloxSecurity
- 711 Change ReadSecurity of MinSize from None to RobloxSecurity
- 711 Change ReadSecurity of MaxSize from None to RobloxSecurity
- 711 Change WriteSecurity of from None to RobloxSecurity
- 711 Change ReadSecurity of from None to RobloxSecurity
- 711 Change ReadSecurity of AspectRatioRange from None to RobloxSecurity
- 711 Change Tags of StyleQuery from [NotReplicated, NotBrowsable] to [NotBrowsable]
- 708 Change Tags of ViewportDisplaySize from [Hidden, NotReplicated, NotScriptable] to [NotReplicated, NotScriptable]
- 708 Change Category of ViewportDisplaySize from Data to Conditions
- 708 Change Category of ReducedMotionEnabled from Data to Conditions
- 708 Change Tags of PreferredInput from [Hidden, NotReplicated, NotScriptable] to [NotReplicated, NotScriptable]
- 708 Change Category of PreferredInput from Data to Conditions
- 708 Change Category of MinSize from Behavior to Conditions
- 708 Change Category of MaxSize from Behavior to Conditions
- 708 Change Category of AspectRatioRange from Behavior to Conditions
- 706 Change Default of ViewportDisplaySize from to Small
- 706 Change Default of PreferredInput from to KeyboardAndMouse
- 706 Change Default of IsActive from true to false
- 705 Add ViewportDisplaySize
- 705 Add ReducedMotionEnabled
- 705 Add PreferredInput
- 704 Change Tags of MinSize from [] to [NotReplicated, NotScriptable]
- 704 Change CanSave of MinSize from true to false
- 704 Change CanLoad of MinSize from true to false
- 704 Change Tags of AspectRatioRange from [] to [NotReplicated, NotScriptable]
- 704 Change CanLoad of AspectRatioRange from true to false
- 704 Change CanSave of AspectRatioRange from true to false
- 703 Change CanSave of MaxSize from true to false
- 703 Change Tags of MaxSize from [] to [NotReplicated, NotScriptable]
- 703 Change CanLoad of MaxSize from true to false
- 699 Add SetConditions
- 699 Add SetCondition
- 699 Add GetConditions
- 699 Add GetCondition
- 699 Add
- 693 Add MinSize
- 693 Add MaxSize
- 693 Add IsActive
- 693 Add AspectRatioRange
- 693 Add StyleQuery
Members 12
AspectRatioRange
| Type | Default | |
|---|---|---|
| NumberRange | 0 inf | |
| Read security | RobloxSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Conditions |
| Loaded/Saved | false |
History 6
- 711 Change ReadSecurity of AspectRatioRange from None to RobloxSecurity
- 708 Change Category of AspectRatioRange from Behavior to Conditions
- 704 Change Tags of AspectRatioRange from [] to [NotReplicated, NotScriptable]
- 704 Change CanLoad of AspectRatioRange from true to false
- 704 Change CanSave of AspectRatioRange from true to false
- 693 Add AspectRatioRange
GetCondition
| Parameters (1) | ||
|---|---|---|
| name | string | |
| Returns (1) | ||
| Variant | ||
Returns the value of a specific condition in the StyleQuery.
| Thread safety | Unsafe |
|---|
History 1
- 699 Add GetCondition
GetConditions
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| Dictionary | ||
Returns a dictionary of key-value pairs describing the conditoins set on
the StyleQuery.
| Thread safety | Unsafe |
|---|
History 1
- 699 Add GetConditions
IsActive
| Type | Default | |
|---|---|---|
| bool | false | |
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
| Condition | Type | Description |
|---|---|---|
AspectRatioRange | NumberRange | Evaluates 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. |
MaxSize | Vector2 | Evaluates to true if the parent GuiBase2d.AbsoluteSize is less than MaxSize. |
MinSize | Vector2 | Evaluates to true if the parent GuiBase2d.AbsoluteSize is greater than or equal to MinSize. |
PreferredInput | PreferredInput | Evaluates to true if PreferredInput matches UserInputService.PreferredInput. |
ReducedMotionEnabled | boolean | Evaluates to true if ReducedMotionEnabled matches GuiService.ReducedMotionEnabled. |
ViewportDisplaySize | DisplaySize | Evaluates to true if ViewportDisplaySize matches GuiService.ViewportDisplaySize. |
| Thread safety | ReadSafe |
|---|---|
| Category | Behavior |
| Loaded/Saved | false/true |
MaxSize
| Type | Default | |
|---|---|---|
| Vector2 | INF, INF | |
| Read security | RobloxSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Conditions |
| Loaded/Saved | false |
History 6
MinSize
| Type | Default | |
|---|---|---|
| Vector2 | 0, 0 | |
| Read security | RobloxSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Conditions |
| Loaded/Saved | false |
History 6
PreferredInput
| Type | Default | |
|---|---|---|
| PreferredInput | KeyboardAndMouse | |
| Read security | RobloxSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Conditions |
| Loaded/Saved | false |
History 5
- 711 Change ReadSecurity of PreferredInput from None to RobloxSecurity
- 708 Change Tags of PreferredInput from [Hidden, NotReplicated, NotScriptable] to [NotReplicated, NotScriptable]
- 708 Change Category of PreferredInput from Data to Conditions
- 706 Change Default of PreferredInput from to KeyboardAndMouse
- 705 Add PreferredInput
ReducedMotionEnabled
| Type | Default | |
|---|---|---|
| bool | false | |
| Read security | RobloxSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Conditions |
| Loaded/Saved | false |
History 3
- 711 Change ReadSecurity of ReducedMotionEnabled from None to RobloxSecurity
- 708 Change Category of ReducedMotionEnabled from Data to Conditions
- 705 Add ReducedMotionEnabled
SetCondition
| Parameters (2) | ||
|---|---|---|
| name | string | |
| value | Variant | |
| 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 | |
| Thread safety | Unsafe |
|---|
History 1
- 699 Add SetCondition
SetConditions
| Parameters (1) | ||
|---|---|---|
| conditions | Dictionary | |
| 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 | |
| Thread safety | Unsafe |
|---|
History 1
- 699 Add SetConditions
ViewportDisplaySize
| Type | Default | |
|---|---|---|
| DisplaySize | Small | |
| Read security | RobloxSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Conditions |
| Loaded/Saved | false |
History 5
- 711 Change ReadSecurity of ViewportDisplaySize from None to RobloxSecurity
- 708 Change Tags of ViewportDisplaySize from [Hidden, NotReplicated, NotScriptable] to [NotReplicated, NotScriptable]
- 708 Change Category of ViewportDisplaySize from Data to Conditions
- 706 Change Default of ViewportDisplaySize from to Small
- 705 Add ViewportDisplaySize