> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/elements-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements-docs/elements-language/component/properties-json/general-structure/visible.md).

# Visible

The `visible` key in an object's properties can be set using a logical expression that evaluates to `true` or `false`. This determines whether a specific UI element is shown or hidden based on the conditions specified in the expression. Works in the same way as [enabled](/elements-docs/elements-language/component/properties-json/general-structure/enabled.md).

* **Boolean Logic**: Use logical operators (`&&`, `||`) to combine multiple conditions.
* **Comparison Operators**: Use `==`, `!=`, `>`, `<`, `>=`, `<=` to compare values.
* **Regex Match**: Use `matches` to perform a regex comparison.

## Examples

1. **Complex Condition**

   ```json
   "visible": "(heroStyle == 'image' || heroStyle == 'video') && showOverlay == true"
   ```

   This makes the property visible only when a hero background is set and the overlay is enabled.
2. **Visibility Based on Numeric Ranges**

   ```json
   "visible": "overlayOpacity > 20 && overlayOpacity < 80"
   ```

   Useful for showing fine-tuning controls only when the opacity is in a middle range.
3. **Negation to Hide Elements**

   ```json
   "visible": "showBadge != true"
   ```

   The property is visible when `showBadge` is `false`.
4. **Match a regex**

   ```json
   "visible": "couponCode matches /^SAVE[0-9]{2}$/"
   ```

   The property is visible when `couponCode` looks like `SAVE10` or `SAVE25`.

The following example toggles visibility based on a switch and a regex match.

```json
{
  "groups": [{
    "title": "CTA Badge",
    "icon": "tag",
    "properties": [{
      "title": "Show Badge",
      "id": "showBadge",
      "responsive": false,
      "switch": {
        "default": false
      }
    }, {
      "title": "Badge Text",
      "id": "badgeText",
      "visible": "showBadge == true",
      "text": {
        "default": "Limited Offer"
      }
    }, {
      "title": "Badge Offset",
      "id": "badgeOffset",
      "visible": "showBadge == true",
      "slider": {
        "default": 8,
        "min": 0,
        "max": 24,
        "round": true,
        "units": "px"
      }
    }]
  }, {
    "title": "Coupon Rules",
    "icon": "ticket",
    "properties": [{
      "title": "Coupon Code",
      "id": "couponCode",
      "responsive": false,
      "text": {}
    }, {
      "information": {},
      "title": "Valid format: SAVE10, SAVE25",
      "visible": "couponCode matches /^SAVE[0-9]{2}$/"
    }]
  }]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.realmacsoftware.com/elements-docs/elements-language/component/properties-json/general-structure/visible.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
