Skip to content

number_input

Displays a numeric input widget and maps its value to the backend as either a float or int.

Basic use

{% htmx_number_input name="my_input" %}
from simmate.website.htmx.components import HtmxComponent

class ExampleView(HtmxComponent):
    my_input = 1234

Parameters

Parameter Description
name The unique name or identifier for the input field. This should match the name of your class attribute in the backend.
Type: str, Default: —
label The display label for the input field. If not provided, the name may be used as the label.
Type: str, Default: None
show_label Whether to display the label alongside the input field.
Type: bool, Default: True
help_text Optional helper text to be shown alongside the input field.
Type: str, Default: None
placeholder The placeholder text to display when input field is empty.
Type: str, Default: "123 if is_int else 0.123
maximum Maximum value allowed to be entered by user. None means no limit.
Type: float, Default: None
minimum Minimum value allowed to be entered by user. None means no limit.
Type: float, Default: None
is_int Whether the input is an integer (set to True) or a float (set to False).
Type: bool, Default: False
step_size Descrete step size of the number. None means it is a continuos float value with no limit on digits.
Type: float, Default: 1 if is_int else "any"
defer Whether to defer processing or submission of the input value.
Type: bool, Default: True
required Whether the field is required for form submission.
Type: bool, Default: False