Conditional top banner element?

Hey there y’all!

I’m wondering if it’s possible to have a top alert banner be conditional to show only when a toggle switch is set to “active” and collapse to nothing/hidden when it’s toggled off?

Here’s the “active” state of the alert banner:

I have the banner set up inside a collection item that’s limited to one item, filtered to show it only if its toggle is set to “active” which works great, but then when I disable it, then it shows up with a grey bar saying “no items found” like so:

Is there a way to set this up so the top banner collapses/hides completely if it’s inactive?

P.S. — I know we can make elements conditionally visible on actual CMS Collection pages, but can this same functionality exist in Collection Lists on regular non-CMS pages?


Here is my public share link: LINK
(how to access public share link)

Great question @adiggy!

If you apply a style to the empty state of a 0px height and 0px of padding top and bottom, and delete the text within the empty state then the empty state will not show any data.

Then setting that collection item to published/unpublished should do the trick of adding/removing it as is necessary.

Please let me know if this is helpful or if you have any additional questions I’m happy to help further. :smile:


Boom, that worked! Thanks so much, Waldo!

1 Like