# Custom HTML Component - Visible Property

**URL:** <https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187>\
**Category:** Elements API\
**Created:** [August 8, 2024, 10:51am UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187 "2024-08-08T10:51:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [August 8, 2024, 10:51am UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/1 "2024-08-08T10:51:53Z")

</div>

I have the following Custom HTML Properties defined:

```auto
{
    "groups": [
            {
      "title": "SWITCH TEST",
      "icon": "switch.2",
      "properties": [
  
        {
          "title": "Test Switch",
          "property": "testSwitch",
          "switch": {
            "trueValue": "ONE",
            "falseValue": "ZERO",
            "default": false
          }
        },

        {
    "information": {},
    "title": "[Displays when FALSE]",
    "visible": "!testSwitch"
    },
        {
    "information": {},
    "title": "[Displays when TRUE]",
    "visible": "testSwitch"
    },
  ]
        
    }
    ]
}

```

I can’t get the appropriate information text to display when I toggle the switch in the properties pane, no information text displays whether the switch is True or False.

Am I doing something wrong (most likely 😉 ) or is it a bug?

---

<div class="post-metadata">

**Author:** ![upssjw](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/upssjw/32/26063_2.png) [@upssjw](https://forums.realmacsoftware.com/u/upssjw)\
**Post date:** [August 8, 2024, 11:43am UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/2 "2024-08-08T11:43:59Z")

</div>

not sure if this will help I used this to toggle overflow off and on  
Html  
overflow-{{displayoff}}  
Properties

{  
“title”: “Visible”,  
“id”: “displayoff”,  
“switch”: {  
“trueValue”: “block”,  
“falseValue”: “hidden”,  
“default”: true  
}  
},

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [August 8, 2024, 12:11pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/3 "2024-08-08T12:11:18Z")

</div>

This is what isn’t working for me:

```auto
{
    "information": {},
    "title": "[Displays when FALSE]",
    "visible": "!testSwitch"
    },
        {
    "information": {},
    "title": "[Displays when TRUE]",
    "visible": "testSwitch"
    },

```

It should display the first information text or the second information text in the right hand properties panel, depending on the state of the “testSwitch" property and “visible” property test.

---

<div class="post-metadata">

**Author:** ![trinube](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@trinube](https://forums.realmacsoftware.com/u/trinube)\
**Post date:** [August 8, 2024, 1:03pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/4 "2024-08-08T13:03:50Z")

</div>

Not sure if this is related but could be - [Banner visibility - #2 by dan](https://forums.realmacsoftware.com/t/banner-visibility/44176/2)

---

<div class="post-metadata">

**Author:** ![upssjw](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/upssjw/32/26063_2.png) [@upssjw](https://forums.realmacsoftware.com/u/upssjw)\
**Post date:** [August 8, 2024, 1:05pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/5 "2024-08-08T13:05:05Z")

</div>

is this what you are trying to do

[https://we.tl/t-LSWK98S9aF](https://we.tl/t-LSWK98S9aF)

links do not download and open for me

create html component  
copy to html

````auto
create html component
copy to html

<div class="text-black text-center">{{display1}}
    
</div>```

copy below to properties

{
    "groups": [{
        "title" : "Main Area",
        "properties" : [

   
{
          "title": "Visible",
          "property": "display1",
          "switch": {
            "trueValue": "Hello",
            "falseValue": "Goodbye",
            "default": true
          }
        },

 ]
		
	}
    ]
}
````

---

<div class="post-metadata">

**Author:** ![upssjw](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/upssjw/32/26063_2.png) [@upssjw](https://forums.realmacsoftware.com/u/upssjw)\
**Post date:** [August 8, 2024, 1:29pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/7 "2024-08-08T13:29:22Z")

</div>

ok copied to dropbox see if this works

[https://www.dropbox.com/scl/fo/z3xyouj5pa688a7wv5oog/AKMbl0-OopwcglC8pBaJH5w?rlkey=a0eoab7nvxl0pme5mta3yql6f&st=ennk2bia&dl=0](https://www.dropbox.com/scl/fo/z3xyouj5pa688a7wv5oog/AKMbl0-OopwcglC8pBaJH5w?rlkey=a0eoab7nvxl0pme5mta3yql6f&st=ennk2bia&dl=0)

---

<div class="post-metadata">

**Author:** ![dan](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dan/32/28516_2.png) [@dan](https://forums.realmacsoftware.com/u/dan)\
**Post date:** [August 8, 2024, 1:32pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/8 "2024-08-08T13:32:23Z")

</div>

Hey @logrunner

The code below will display and hide other controls in the inspector based on the state of the switch. Let me know if you need anything else!

```auto
{
    "groups": [
            {
      "title": "SWITCH TEST",
      "icon": "switch.2",
      "properties": [
  
        {
          "title": "Test Switch",
          "property": "testSwitch",
          "switch": {
            "trueValue": true,
            "falseValue": false,
            "default": false
          }
        },

        {
          "information": {},
          "title": "I'm False",
          "visible": "testSwitch == false"
        },

        {
          "information": {},
          "title": "I'm True",
          "visible": "testSwitch == true"
        },

  ]
        
    }
    ]
}

```

---

<div class="post-metadata">

**Author:** ![logrunner](https://avatars.discourse-cdn.com/v4/letter/l/59ef9b/32.png) [@logrunner](https://forums.realmacsoftware.com/u/logrunner)\
**Post date:** [August 8, 2024, 1:57pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/9 "2024-08-08T13:57:31Z")

</div>

@upssjw - Thanks for taking the time and effort to try and understand and resolve my issue. 👍

@dan - I think I was led astray by the “visible” documentation that states:

```auto
3. Negation to Hide Elements
"visible": "!mySwitchControl"

```

It is all working now, thanks. 😄

---

<div class="post-metadata">

**Author:** ![upssjw](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/upssjw/32/26063_2.png) [@upssjw](https://forums.realmacsoftware.com/u/upssjw)\
**Post date:** [August 8, 2024, 2:01pm UTC](https://forums.realmacsoftware.com/t/custom-html-component-visible-property/44187/10 "2024-08-08T14:01:15Z")

</div>

Dan sorted it
