The Number field only accepts number entries (integers and decimals) and returns a JSON number in the API, which makes it perfect for prices, quantities, and dimensions.Documentation Index
Fetch the complete documentation index at: https://buttercms.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Field at a glance
Input and output
Input type
Numbers (integers, decimals, and floats)
API output
numberAPI response example
Field configuration options
Option Name | Type | Function |
|---|---|---|
| Required? | boolean | Make field required to save page |
| Default value | string | Set a default value for the field |
Common use cases
E-commerce- Product prices
- Stock quantities
- Shipping weights
- Discount percentages
- Order totals
- Event capacity
- Number of attendees
- Duration in minutes/hours
- Room numbers
- Read time estimates
- View counts
- Rating scores
- Sort order/priority
- Display order
- Maximum items to show
- Pagination limits
Handling different number types
Integers
Number fields support integers (numbers without a decimal), including both zero and negative integers.Decimals (floats)
Number fields support decimal/float values with no restriction on the number of places after the decimal. This includes both 0.00 and negative numbers.Large numbers
Be aware of JavaScript’s number precision limits for very large numbers:Number field vs. Short Text for numbers
| Aspect | Number Field | Short Text |
|---|---|---|
| API output | number | "string" |
| Validation | Built-in numeric validation | Manual regex needed |
| Math operations | Works directly | Requires parsing |
| Sorting | Correct numeric sort | Alphabetical sort |
Best practices
Prices
- Consider your currency’s decimal precision
- Use help text to specify the expected currency
Quantities
- Use integers only (no decimals)
- Use help text to clarify expected values
Percentages
- Clarify in help text whether to enter as
15or0.15for 15%
Ratings
- Consider using a dropdown for consistent values