Conditional visibility
You can control whether an element appears by adding a condition to it. A conditional element is only visible to users who meet the specified criteria.
A condition can also evaluate the state of another element. For example, you can show a hint only if a button is Disabled.
If you show or hide an element using the Show element or Hide element action, the action overrides the Visibility condition set on that element. The override lasts until a variable or element state in the condition is updated.
On an element with a Visibility condition, these actions change the element at once, without animation or delay.
Use Visibility conditions for elements that should appear or hide based on a criterion, such as a quiz answer. Use actions when visibility should change at a specific moment, such as when the screen opens or users tap an element.
To add a condition to an element:
- Select the element in the canvas or layer panel.
- In the Visibility section of the right panel, select Conditional.
- To set up the condition, select a property type from one of the following tabs:
- Custom: Variables you create and manage; their values can be updated via user interactions. See Variables for details.
- Product: Properties of the products in your flow, such as price or name.
- Elements: Variables of other elements, such as a quiz answer or whether a toggle is on.
- States: The state of another element on the screen, such as a Disabled button.
- System: The platform of the user’s device,
system.platform. See Show an element on one platform only.
- Enter the Value to match.
- Click the operator to change it if needed.
- (Optional) Click Add condition to add more conditions. Use the selector to require all conditions to match, or any one of them.
Show an element on one platform only
To keep one flow for iOS and Android, show platform-specific elements only on their platform. For example, show “Manage your subscription in App Store settings” on iOS, and “Manage your subscription in Google Play” on Android.
- Select the element, and in the Visibility section, select Conditional.
- Click the Variable field, open the System tab, and select
system.platform. - In the value dropdown, select iOS or Android. With
=, the element shows only on that platform. With!=, it shows only on the other platform.
The Adapty SDK reports the platform, so your app doesn’t need to pass it. Android devices, including Huawei devices, match Android.
The canvas shows the element if the condition matches the platform of the preview device. To preview the other platform, select a device of that platform in the preview controls.
To show a whole screen on one platform only, use a conditional action.