pynecone-debounce-input
A wrapper around the generic react-debounce-input component for the
python-based full stack pynecone framework.
Since all events in pynecone 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 pynecone as pc
from pynecone_debounce_input import debounce_input
class State(pc.State):
query: str = ""
app = pc.App(state=State)
@app.add_page
def index():
return pc.center(
pc.hstack(
debounce_input(
pc.input(
placeholder="Query",
value=State.query,
on_change=State.set_query,
),
),
pc.text(State.query),
)
)
app.compile()
pc init
pc run
Also work with textarea, simply pass pc.text_area as the child. See larger example in the repo.
Usage
- Include
pynecone-debounce-inputin your projectrequirements.txt. - Include a specific version of
react-debounce-inputinpcconfig.py.
config = pc.Config(
...,
frontend_packages=[
"react-debounce-input@3.3.0",
],
)
- Wrap
pynecone_debounce_input.debounce_inputaround the component to debounce (typically apc.inputorpc.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 pynecone_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 pynecone-debounce-input 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pynecone-debounce-input-0.3.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pynecone_debounce_input-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / pynecone-debounce-input-0.3.tar.gz
| Download URL | pynecone-debounce-input-0.3.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ae211d51eec310ac0cf15350debd3b41efe60f12c6eaeedfa362eb8275a5a3d
|
|
BLAKE2b-256 checksum How to use checksums |
75641c55011dba38f9d541bd33b7b1b66311436ed3a153a172bbc6aaae3b27f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / pynecone_debounce_input-0.3-py3-none-any.whl
| Download URL | pynecone_debounce_input-0.3-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7f6a3e4f7290380f4924d80de65373f8e758b8bf24b853fbfb1c96fe79d1f2c
|
|
BLAKE2b-256 checksum How to use checksums |
43b283da9062827f638946ca7816750b8db234109d045e69184c9112b8f53789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|