toloka.client.project.template_builder.helpers.IfHelperV1
| Source code
IfHelperV1( self, condition: Optional[BaseComponent] = None, then: Optional[Any] = None, *, else_: Optional[Any] = None, version: Optional[str] = '1.0.0')
The if then else
operator.
For more information, see helper.if.
Parameters | Type | Description |
---|---|---|
condition | Optional[BaseComponent] | A condition to check. |
then | Optional[Any] | A component that is returned if the condition is |
else_ | Optional[Any] | A component that is returned if the condition is |
Examples:
How to conditionally show a part of the interface.
import toloka.client.project.template_builder as tbhidden_ui = tb.helpers.IfHelperV1( condition=tb.conditions.EqualsConditionV1(tb.data.OutputData('show_me'), 'show'), then=tb.view.ListViewV1([header, buttons, images]),)
Last updated: August 28, 2023