Pricing Blog

Set Visibility According to Children's Visibility

  • _.__._.__.__._-1433383106038988910

    Ethan

    9 days ago

    I have a container component with a Slot element. I would like to only have the container (parent) component visible if one or more of the children residing in the slot are visible.

    So far the best idea I've had would be to create some custom code formula, but I don't really know how to do this, or if there is a more obvious solution.

    This is for a titled subsection in a popup menu, where some options are only visible in certain conditions.

    Many thanks.
    1
  • jacobkofoed-1433383488844861583

    Jacob Kofoed

    9 days ago

    I often use the :empty style variant for this and set display to "none" for the parent when it has no rendered children.
  • _.__._.__.__._-1433418549593899038

    Ethan

    9 days ago

    I'd like to use this, but the problem is that the wrapper has a text and a slot, so it will never meet the criteria for empty
  • _.__._.__.__._-1433421679429812325

    Ethan

    9 days ago

    I've got a solution. I used the :last-child extension on the heading, and set that to display:none
    🙌2