Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use "Only show when" on adaptive card

I have tried to search many places but I don't see any doc talk about how to use it.

https://i.sstatic.net/DTkM5.png

like image 908
Peter Phung Avatar asked Oct 23 '25 09:10

Peter Phung


1 Answers

Without seeing more of your card, I think you need to remove the second $. Here's a very simple example:

Card:

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "${title}",
            "$when": "${showTitle == true}"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3"
}

Data:

{
    "title": "This is a title",
    "showTitle": true
}

If you change showTitle to false in the data, the text will no longer show.

like image 148
mdrichardson Avatar answered Oct 26 '25 19:10

mdrichardson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!