Tile Card: Hide features when off

So you can technically do this with card-mod, but it’s a bit janky and a native solution would be significantly preferable.

Credit to LiQuid_cOOled over in this thread, if you don’t have any card-mod styling already, you can simply add:

card_mod:
  style:
    hui-card-features$:
      hui-card-feature$:
        hui-light-brightness-card-feature$: |
          ha-control-slider {
            display: {{ 'none' if is_state(config.entity, 'off') else 'block' }};
          }

But if you are using ha-card styling already, you can combine the 2 like this (using a dark transparent ha-card style as an example):

card_mod:
  style:
    .: |
      ha-card {
        background: rgba(0, 0, 0, 0.5);
        border: none;
        box-shadow: none;
        border-radius: 12px;
      }
    hui-card-features$:
      hui-card-feature$:
        hui-light-brightness-card-feature$: |
          ha-control-slider {
            display: {{ 'none' if is_state(config.entity, 'off') else 'block' }};
          }

The problem though is that the default card without the slider feature enabled takes up a single row, where it takes 2 rows if it’s enabled. With this card-mod styling though the card always takes up 2 rows even if the slider is hidden.

I spent a good while trying to figure out a way to get around this, but it seems like Home Assistant forces the tile card to be 2 rows tall the second the “features:” flag is added. If anyone can figure out a way around this, that would be great. Hopefully this will be fixed officially soon enough that that won’t be needed however. Seems like just a bit of oversight, can’t imagine most people want the slider to show up when the card is off