reflex-dev / reflex

🕸️ Web apps in pure Python 🐍
https://reflex.dev
Apache License 2.0
20.41k stars 1.18k forks source link

Make `rx.debounce_input` Work with `rx.el.input` for Flexible Input Styling #4184

Open sorousch9 opened 1 month ago

sorousch9 commented 1 month ago

Describe the Custom Component Hey there! So, I've been playing around with a custom component, and I've run into a hiccup that I need help with. Basically, I'm trying to use rx.debounce_input with rx.el.input instead of the usual rx.input because I want to tweak the styles a bit more. A clear and concise description of what the custom component does.

Extra Info: Right now, trying to use rx.el.input like this throws a frontend error: ReferenceError: input is not defined. Here’s a quick peek at the code causing the headache:

def input_field() -> rx.Component:
    return rx.el.div(
        rx.debounce_input(
            rx.el.input("test", ),
            debounce_timeout=300,
        ),
    )

Would love for rx.debounce_input to recognize and handle rx.el.input without freaking out. Thanks a bunch!

abulvenz commented 1 month ago
  • I want more control over how my input fields look and behave. Right now, rx.input adds some default styles and a div that I don’t really want, so using rx.el.input seems like the way to go.

And you can add things like type="tel" then :+1: