# Hide svg in repeater based on boolean value in CMS

**URL:** <https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008>\
**Category:** Ask the community\
**Tags:** wix-studio, cms, code\
**Created:** [November 17, 2025, 12:52pm UTC](https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008 "2025-11-17T12:52:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anyaa](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anyaa](https://forum.wixstudio.com/u/anyaa)\
**Post date:** [November 17, 2025, 12:52pm UTC](https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008/1 "2025-11-17T12:52:46Z")

</div>

**Hello everyone,**

I am trying to display a label (svg or png) in a repeater that is connected to a data collection in CMS. However, the label should only be displayed when the boolean value is true in the connected data collection. I tried to solve it with the following code, but it didn’t work. Has anyone had a similar issue or knows how to solve it?

Thaaank you so much for any kind of help.

This is the code I tried to use:

$w.onReady(function () {  
$w(“#repeater1”).onItemReady(($item, itemData, index) =\> {

```
const shouldShow = itemData.showgraphic; // field key from your dataset

if (shouldShow) {
  $item("#vectorImage8").show();      
  $item("#vectorImage8").expand();
} else {
  $item("#vectorImage8").hide();

```

$item(“#vectorImage8”).collapse();  
}  
});  
});

---

<div class="post-metadata">

**Author:** ![thomasj](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/thomasj/32/30791_2.png) [@thomasj](https://forum.wixstudio.com/u/thomasj)\
**Post date:** [November 17, 2025, 9:39pm UTC](https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008/2 "2025-11-17T21:39:52Z")

</div>

You can accomplish this using a [Filter with Wix Data](https://dev.wix.com/docs/velo/apis/wix-data/filter) or a [Dataset Filter](https://dev.wix.com/docs/velo/velo-only-apis/$w/dynamic-dataset/set-filter) depending on how you populate the repeater with items.

By creating a filter that checks if a certain value in the itemData is “true” with [.eq()](https://dev.wix.com/docs/velo/velo-only-apis/$w/wix-data-filter/eq), you can make the repeater only populate with the items you desire.

---

<div class="post-metadata">

**Author:** ![anyaa](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anyaa](https://forum.wixstudio.com/u/anyaa)\
**Post date:** [December 5, 2025, 8:39am UTC](https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008/3 "2025-12-05T08:39:31Z")

</div>

Thank you so much for your help. I solved it with the following code:

```javascript
$w.onReady(() => {
$w(‘#yourDataset’).onReady(() => {
    $w('#yourRepeater').onItemReady(($item, itemData) => {

        if (itemData.available === true) { // <— your boolean field key
            $item('#availabilityIcon').show();
        } else {
            $item('#availabilityIcon').hide();
        }

    });

});

});

```

---

<div class="post-metadata">

**Author:** ![esterk](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/esterk/32/32866_2.png) [@esterk](https://forum.wixstudio.com/u/esterk)\
**Post date:** [December 18, 2025, 1:58pm UTC](https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008/4 "2025-12-18T13:58:08Z")

</div>

This line wasn’t supposed to be here, but now it’s committed.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [January 17, 2026, 1:58pm UTC](https://forum.wixstudio.com/t/hide-svg-in-repeater-based-on-boolean-value-in-cms/75008/5 "2026-01-17T13:58:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
