Skip to main content

Number input element

Example:

An example of a Number input element

Fields

FieldsTypeDescriptionRequired?
typeStringThe type of element. In this case type is always number_input.Required
is_decimal_allowedBooleanDecimal numbers are allowed if is_decimal_allowed= true, set the value to false otherwise.Required
action_idStringAn identifier for the input value when the parent modal is submitted. You can use this when you receive a view_submission payload to identify the value of the input element. Should be unique among all other action_ids in the containing block. Maximum length is 255 characters.Optional
initial_valueStringThe initial value in the plain-text input when it is loaded.Optional
min_valueStringThe minimum value, cannot be greater than max_value.Optional
max_valueStringThe maximum value, cannot be less than min_value.Optional
dispatch_action_configObjectA dispatch configuration object that determines when during text input the element returns a block_actions payload.Optional
focus_on_loadBooleanIndicates whether the element will be set to auto focus within the view object. Only one element can be set to true. Defaults to false.Optional
placeholderObjectA plain_text only text object that defines the placeholder text shown in the number input. Maximum length for the text in this field is 150 characters.Optional

Usage info

Interactive component - see our guide to enabling interactivity.

The number input element accepts both whole and decimal numbers. For example, 0.25, 5.5, and -10 are all valid input values. Decimal numbers are only allowed when is_decimal_allowed is equal to true.

Example

{
"type": "input",
"element": {
"type": "number_input",
"is_decimal_allowed": false,
"action_id": "number_input-action"
},
"label": {
"type": "plain_text",
"text": "Label",
"emoji": true
}
}