reflex-debounce-input
A wrapper around the generic react-debounce-input component for the
python-based full stack reflex framework.
Since all events in reflex are processed on the server-side, a client-side input debounce makes the app feel much less sluggish when working will fully controlled text inputs.
Example
import reflex as rx
from reflex_debounce_input import debounce_input
class State(rx.State):
query: str = ""
app = rx.App(state=State)
@app.add_page
def index():
return rx.center(
rx.hstack(
debounce_input(
rx.input(
placeholder="Query",
value=State.query,
on_change=State.set_query,
),
),
rx.text(State.query),
)
)
app.compile()
reflex init
reflex run
Also work with textarea, simply pass rx.text_area as the child. See larger example in the repo.
Usage
- Include
reflex-debounce-inputin your projectrequirements.txt. - Include a specific version of
react-debounce-inputinrxconfig.py.
config = rx.Config(
...,
frontend_packages=[
"react-debounce-input@3.3.0",
],
)
- Wrap
reflex_debounce_input.debounce_inputaround the component to debounce (typically arx.inputorrx.text_area).
Props
See documentation for react-debounce-input.
min_length: int = 0
Minimal length of text to start notify, if value becomes shorter then minLength (after removing some characters), there will be a notification with empty value ''.
debounce_timeout: int = 100
Notification debounce timeout in ms. If set to -1, disables automatic notification completely. Notification will only happen by pressing Enter then.
force_notify_by_enter: bool = True
Notification of current value will be sent immediately by hitting Enter key. Enabled by-default. Notification value follows the same rule as with debounced notification, so if Length is less, then minLength - empty value '' will be sent back.
NOTE: if onKeyDown callback prop was present, it will be still invoked transparently.
force_notify_on_blur: bool = True
Same as force_notify_by_enter, but notification will be sent when focus leaves the input field.
Changelog
v0.3 - 2023-05-19
- Support pynecone >= 0.1.30 (
pynecone.varchanged topynecone.vars)
v0.2 - 2023-04-24
import reflex_debounce_inputautomatically addsreact-debounce-inputtoConfig.frontend_packages- fix example in README, missing comma
- improve test assertions when exporting example project
v0.1 - 2023-04-21
Initial Release
Metadata
Release files for reflex-debounce-input 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reflex-debounce-input-0.4.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reflex_debounce_input-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / reflex-debounce-input-0.4.tar.gz
| Download URL | reflex-debounce-input-0.4.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9383d089c0ffa055f2f50ff678d2267d9206383a120d805b736954045b264336
|
|
BLAKE2b-256 checksum How to use checksums |
4715b4005ddca559a2d113049386f0e1a778443ae4ab6133450d2a7c152f61d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|
Release files / reflex_debounce_input-0.4-py3-none-any.whl
| Download URL | reflex_debounce_input-0.4-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bd81714accdc09ffa5a1ce70cd9393f858d328a5539fb6ea515da7a1095030f
|
|
BLAKE2b-256 checksum How to use checksums |
ffbce305ed0434b89c61b84c6b008822980b9b8b4f74cd84b8b054f10e055691
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.4
|