Skip to main content

showIf

Decorator that conditionally shows or hides a property in the inspector based on another property's value.

TypeNameInterface Description
FunctionsshowIf(propertyName: string, condition: string | number | boolean): (target: any, key: string) => any

Function: Decorator that conditionally shows or hides a property in the inspector based on another property's value. Useful for creating dynamic UI that adapts to user selections.

Parameters

propertyName: - The name of the property to check

condition: - The value that triggers visibility (string, number, or boolean)

Returns Property decorator function

Example

@component()
export class EffectController extends APJS.BasicScriptComponent {
@serializeProperty()
public enableEffect: boolean = false;

@serializeProperty()
@showIf("enableEffect", true)
public effectIntensity: number = 0.5;

@serializeProperty()
@showIf("enableEffect", true)
public effectType: string = "linear";
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies