Try this code.
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "Select an option to provide input:",
"wrap": true
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Option A",
"targetElements": [
{
"elementId": "inputA",
"isVisible": true
},
{
"elementId": "inputB",
"isVisible": false
}
]
},
{
"type": "Action.ToggleVisibility",
"title": "Option B",
"targetElements": [
{
"elementId": "inputA",
"isVisible": false
},
{
"elementId": "inputB",
"isVisible": true
}
]
}
]
},
{
"type": "Input.Text",
"id": "inputA",
"label": "Enter your name",
"placeholder": "Name",
"isVisible": false
},
{
"type": "Input.Text",
"id": "inputB",
"label": "Enter your phone number",
"placeholder": "Phone",
"isVisible": false
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
]
}

✅ Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
❤️ Please consider giving it a Like, If the approach was useful in other ways.
🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.