fix: let rx.input take the HTML autocomplete string, and turn a bool into "on" or "off"

Merged
BE
6d ago
+45-3

Fixes #7417.

TextFieldRoot.auto_complete is now Var[str], like elements.Input.auto_complete and the generated stub, so rx.input(auto_complete="off") renders autoComplete:"off" instead of raising a TypeError.

React drops a bool autoComplete, so TextFieldRoot.create now maps a bool to "on" or "off", and a bool Var to (var ? "on" : "off"). Existing auto_complete=True/False code keeps working, and now actually sets the attribute. The stub still types the prop as str, which steers type checkers towards the string form.

The stub itself doesn't change. The pyi generator already emitted elements.Input's str type and doc for this prop; that generator bug is described in the issue and left for a separate fix.

Testing:

  • tests/units/components/radix/test_text_field.py covers strings, bools, a bool Var and a str Var. All 6 cases fail without the change.
  • tests/units/components passes (4199 tests), and so do the pre-commit hooks, including pyright.

🤖 Generated with Claude Code