# Elements language @if

**URL:** <https://forums.realmacsoftware.com/t/elements-language-if/50818>\
**Category:** Elements API\
**Created:** [September 5, 2025, 9:25pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818 "2025-09-05T21:25:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Invisigoth](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/invisigoth/32/29525_2.png) [@Invisigoth](https://forums.realmacsoftware.com/u/Invisigoth)\
**Post date:** [September 5, 2025, 9:25pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/1 "2025-09-05T21:25:15Z")

</div>

Hi there, if I’d like to use a segmented UI control for z-index “none - auto - custom“, how can I test the value of the user choice?

I read in the documentation, [If Documentation](https://docs.realmacsoftware.com/elements-docs/elements-language/component/language/if) that the @if is only for testing if a value is true or false. Is this correct?

There is a possibility for test “value = something → do something”?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Doobox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/doobox/32/32373_2.png) [@Doobox](https://forums.realmacsoftware.com/u/Doobox)\
**Post date:** [September 5, 2025, 9:40pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/2 "2025-09-05T21:40:09Z")

</div>

Hi there, Do you mean inside another custom control, to decide if that control should be shown or not?

Or do you mean to do something in the template based on the value of the segmented UI control?, short answer would be “No”.

If you need to show / hide another control based on the value of that one, use “visible”:

`{`  
`“title”: “Some Control”,`  
`“id”: “customID”,`  
`“responsive”: false,`  
`“visible”: “segmented-UI-control-ID == ‘custom’”,`  
`“text”: {`  
`“default” : “”`  
`}`

---

<div class="post-metadata">

**Author:** ![Invisigoth](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/invisigoth/32/29525_2.png) [@Invisigoth](https://forums.realmacsoftware.com/u/Invisigoth)\
**Post date:** [September 5, 2025, 10:06pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/3 "2025-09-05T22:06:15Z")

</div>

Something like this:

 ![Screenshot 2025-09-06 alle 00.12.48](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/3X/6/6/66f8c889a3e2c48c5987d835f5303aaabed2e8fa.png)

---

<div class="post-metadata">

**Author:** ![Doobox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/doobox/32/32373_2.png) [@Doobox](https://forums.realmacsoftware.com/u/Doobox)\
**Post date:** [September 5, 2025, 10:14pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/4 "2025-09-05T22:14:40Z")

</div>

So all you need to do for that is set the properties like this example, and write for this example {{zcontrol}} in the template, and it will be replaced with the selected value.

`{`  
`“groups”: [{`  
`“title”: “Segmented Example”,`  
`“properties”: [{`  
`“title”: “Z Index”,`  
`“id”: “zcontrol”,`  
`“segmented”: {`  
`“items”: [{`  
`“value”: “z-auto”,`  
`“title”: “Auto”`  
`}, {`  
`“value”: “z-99”,`  
`“title”: “Custom”,`  
`“default”: true`  
`}, {`  
`“value”: “”,`  
`“title”: “None”`  
`}]`  
`}`  
`}]`  
`}]`  
`}`

---

<div class="post-metadata">

**Author:** ![Invisigoth](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/invisigoth/32/29525_2.png) [@Invisigoth](https://forums.realmacsoftware.com/u/Invisigoth)\
**Post date:** [September 6, 2025, 7:56am UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/5 "2025-09-06T07:56:31Z")

</div>

Thanks, this is correct and I think the same… but if I’d like to set a custom value, not z-99 and I put in template box {{zcontrol}} I can’t customize the vale.

---

<div class="post-metadata">

**Author:** ![Doobox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/doobox/32/32373_2.png) [@Doobox](https://forums.realmacsoftware.com/u/Doobox)\
**Post date:** [September 6, 2025, 12:02pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/6 "2025-09-06T12:02:40Z")

</div>

Make the value of “Custom” return “custom”.

Make a number control that only becomes visible if value of Custom is “custom”, as shown earlier.

Then process in your hooks file:

```javascript
const transformHook = (rw) => {    
  const { zcontrol, znumber } = rw.props;

  let processed_z = "";

  switch (zcontrol) {
	case "custom":
	  processed_z = "z-" + znumber;
	  break;

	case "z-auto":
	  processed_z = "z-auto";
	  break;

	default:
	  processed_z = "";
	  break;
  }

  rw.setProps({
	node: rw.node,
	processed_z
  });
};

exports.transformHook = transformHook;

```

---

<div class="post-metadata">

**Author:** ![Invisigoth](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/invisigoth/32/29525_2.png) [@Invisigoth](https://forums.realmacsoftware.com/u/Invisigoth)\
**Post date:** [September 7, 2025, 4:28pm UTC](https://forums.realmacsoftware.com/t/elements-language-if/50818/7 "2025-09-07T16:28:06Z")

</div>

Thank you!!!
