Skip to content

Commit 038a0ef

Browse files
committed
fix text_field creating number input (#5126)
* fix text_field creating number input * only do it on cls is Input
1 parent 062f771 commit 038a0ef

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

reflex/components/el/elements/forms.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,15 +460,16 @@ def create(cls, *children, **props):
460460
value_var.is_not_none(), value_var, Var.create("")
461461
)
462462

463-
input_type = props.get("type")
463+
if cls is Input:
464+
input_type = props.get("type")
464465

465-
if input_type == "checkbox":
466-
# Checkbox inputs should use the CheckboxInput class
467-
return CheckboxInput.create(*children, **props)
466+
if input_type == "checkbox":
467+
# Checkbox inputs should use the CheckboxInput class
468+
return CheckboxInput.create(*children, **props)
468469

469-
if input_type == "number" or input_type == "range":
470-
# Number inputs should use the ValueNumberInput class
471-
return ValueNumberInput.create(*children, **props)
470+
if input_type == "number" or input_type == "range":
471+
# Number inputs should use the ValueNumberInput class
472+
return ValueNumberInput.create(*children, **props)
472473

473474
return super().create(*children, **props)
474475

0 commit comments

Comments
 (0)