How to Set a Minimum and Maximum on an Adaptive Card Number Input
Quantities, ages, people per room: many card fields want a number within limits. An Adaptive Card Input.Number takes a min and a max, and in Microsoft Teams, the box keeps every number inside them.
Syntax
{
"type": "Input.Number",
"id": "<input id>",
"label": "<label>",
"min": <lowest number>,
"max": <highest number>,
"value": <starting number>,
"errorMessage": "<what to show when the number is wrong>"
}
| Part | What it does |
|---|---|
min | Hint of minimum value (may be ignored by some clients). |
max | Hint of maximum value (may be ignored by some clients). |
value | Initial value for this field. |
errorMessage | Error message to display when entered input is invalid |
The descriptions are from Microsoft's Input.Number reference. Hint matters: each app that shows the card decides how to keep to the range. The Input Validation guide says what can happen: Min and max properties (including maxLength) on some platforms may be enforced directly by the control. ... In that case, the error message may not be shown.
The Example
A concert ticket card allows 1 to 4 tickets, starts at 1, and says the range in its label, Tickets (1 to 4).
Prerequisites
- An agent that sends Adaptive Cards in Microsoft Teams and reads what a card's Submit button sends.
Step 1: Write the Card
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{ "type": "TextBlock", "text": "Concert tickets", "size": "Large", "weight": "Bolder" },
{
"type": "Input.Number",
"id": "tickets",
"label": "Tickets (1 to 4)",
"min": 1,
"max": 4,
"value": 1,
"errorMessage": "Pick from 1 to 4 tickets."
}
],
"actions": [
{ "type": "Action.Submit", "title": "Buy", "data": { "card": "tickets" } }
]
}

min, max and value are numbers in the JSON, without quotes.
Step 2: Try a Number Below the Minimum
Send the card from your agent, as How to Send an Adaptive Card in the Microsoft 365 Agents SDK in C# shows. It opens at 1:

Type 0:

Then select the card's title, to leave the box:

Teams changed 0 to 1, the minimum, without a message. A number above the maximum goes to the maximum the same way.
Step 3: Buy
Type 2, and select Buy. The agent for this post replies with the values it receives:

{"card":"tickets","tickets":"2"}
The number arrived as text, "2". Parse it before you calculate with it, for example with int.TryParse in C#.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Counting on errorMessage to explain the range | In Teams, the box changes the number instead, with no message | Say the range in the label |
Trusting min and max alone | They're hints, and other apps may not enforce them | Check the number in the agent too |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| A typed number changes when you leave the box | Teams moves it into the range | Expected: the box shows what will be sent |
| The agent can't do math with the value | It's text, such as "2" | Parse it first |
FAQ
Why didn't the error message show for 6 on a 1-to-4 box?
Because Teams changed it to 4 when the box lost focus, so nothing was out of range when the card checked: Fixed: An Adaptive Card Number Input in Teams Changes to Its Maximum Instead of Showing the Error Message follows that one through.
How do I make the number required?
Add "isRequired": true, with the errorMessage: How to Make Adaptive Card Inputs Required.
Conclusion
Give an Input.Number a min, a max and a starting value, and say the range in its label. Teams keeps the number inside the range by itself, and the card sends it as text, so your agent parses it and checks it once more.
Additional Resources
- Input.Number, on Microsoft Learn.
- Input Validation, on Microsoft Learn.
