Skip to main content

How to Show Label and Value Pairs in an Adaptive Card with a FactSet

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

An order summary, a ticket's details, a request to check before sending: they're all a few labels with values. An Adaptive Card FactSet lays such pairs out in two columns, labels on the left and values on the right, without any layout work.

Syntax​

Card JSON
{
"type": "FactSet",
"facts": [
{ "title": "<label>", "value": "<value>" }
]
}
PartWhat it does
factsThe pairs, in order
titleThe title of the fact.: the label, on the left
valueThe value of the fact.: on the right

Both are text, and both are required. The descriptions are from Microsoft's Fact reference, which calls a fact a key/value pair.

The Example​

An order card shows four facts: Order A-1042, Items 2 notebooks, 1 headset, Status On its way and Arrives Thursday.

Prerequisites​

  • An agent that sends Adaptive Cards in Microsoft Teams.

Step 1: Write the Card​

Cards/order.json
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{ "type": "TextBlock", "text": "Your order", "size": "Large", "weight": "Bolder" },
{
"type": "FactSet",
"facts": [
{ "title": "Order", "value": "A-1042" },
{ "title": "Items", "value": "2 notebooks, 1 headset" },
{ "title": "Status", "value": "On its way" },
{ "title": "Arrives", "value": "Thursday" }
]
}
]
}

order.json in a macOS-style editor window: an Adaptive Card with a Your order title and a FactSet with four facts, Order A-1042, Items 2 notebooks, 1 headset, Status On its way and Arrives Thursday

Step 2: See It in Teams​

Send the card from your agent, as How to Send an Adaptive Card in the Microsoft 365 Agents SDK in C# shows:

The Your order card in Teams: four rows with bold labels Order, Items, Status and Arrives on the left, and A-1042, 2 notebooks, 1 headset, On its way and Thursday on the right

Teams showed the labels in bold, and lined the values up in one column after the longest label.

Common Mistakes​

MistakeWhat happensDo this instead
A FactSet for anything people should fill inFacts are read-onlyUse inputs for answers
A missing detail left out of factsThe card skips that label, so people can't tell it's missingKeep the fact, with a value such as None

Troubleshooting​

SymptomLikely causeFix
The values don't line upThey're in separate TextBlocks, not one FactSetPut the pairs in one FactSet

FAQ​

When should I build the facts in code?​

When the values come from data, such as an order your agent looks up. Build the facts array in code, one object per pair, and convert every value to text.

Conclusion​

To show label and value pairs in an Adaptive Card, use a FactSet: a facts array of objects with a title and a value, both text. Teams lays them out in two columns, with the labels in bold.

Additional Resources​

  • FactSet, on Microsoft Learn.
  • Fact, on Microsoft Learn.