Conditional element inside picture-elements card

Hi, I am trying to hide/show a card based on the state of another entity. I read many posts here and I think my syntax is correct. But apparently not… I’m out of clues, any suggestions? Thanks

 - type: conditional
                conditions:
                  - entity: switch.p5
                    state: 'on'
                card:
                  - type: custom:slider-button-card
                    entity: switch.p5_2
                    show_name: false
                    show_state: false
                    icon:
                      tap_action:
                        action: toggle
                      use_state_color: true
                      hold_action:
                        action: none
                    style:
                      left: 83%
                      top: 33%
                    compact: true
                    slider:
                      toggle_on_click: true
                    action_button:
                      show: false
                    mode: custom

Should look like this:

type: conditional
conditions:
  - condition: state
    entity: switch.p5
    state: "on"

Thanks, the weird indentations was a copy-paste problem here in the UI. But you are right: the ‘condition’ keyword was missing.

I have just discovered what I was actually doing wrong: instead of a ‘conditional card’, I needed a ‘conditional element’ inside my picture-elements card…

This yaml is working fine now and doing exactly what I want:

              - type: conditional
                conditions:
                - entity: switch.p5
                  state: 'on'
                elements:
                - type: custom:slider-button-card
                  entity: switch.p5_2
                  show_name: false
                  show_state: false
                  icon:
                    tap_action:
                      action: toggle
                    use_state_color: true
                    hold_action:
                      action: none
                  style:
                    left: 83%
                    top: 33%
                  compact: true
                  slider:
                    toggle_on_click: true
                  action_button:
                    show: false
                  mode: custom

Thanks again for your help @rossk