Registry / web-framework / streamlit-keyup

streamlit-keyup

JSON →
library0.3.0pypypi✓ verified 84d ago

Streamlit-keyup is a custom component for Streamlit applications that provides a text input field which updates its value in real-time, on every key press (on keyup event). This differs from Streamlit's native `st.text_input` which typically waits for the user to press Enter or for the widget to lose focus. The library is currently at version 0.3.0 and receives occasional updates, primarily for compatibility and minor fixes.

pip install streamlit-keyup
INSTALL
IMPORT
SIG · STREAMLIT-KEYUP
S
streamlit-keyup
web-frameworkpythonv0.3.0
Install
15.6s avg
Import
1350ms
Disk
433MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 1.733s · 444.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 15.6s · import 0.966s · 414MB
433MB installed
● package 433MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

st_keyup
from st_keyup import st_keyup

This example demonstrates the basic usage of `st_keyup`, including setting a default value, using the `debounce` parameter to control update frequency, and combining `max_chars`, `placeholder`, and `disabled` arguments.

import streamlit as st from st_keyup import st_keyup st.title("Streamlit Keyup Demo") # Basic usage: value updates after every key press value_basic = st_keyup("Enter text here", key="keyup_basic") st.write(f"Basic Input: {value_basic}") # Usage with a default value value_with_default = st_keyup("Enter with default", value="Hello world", key="keyup_default") st.write(f"Input with default: {value_with_default}") # Usage with debounce to limit update frequency (e.g., update every 500ms) value_debounced = st_keyup("Enter with debounce", debounce=500, key="keyup_debounced") st.write(f"Debounced Input: {value_debounced}") # Example with max_chars, placeholder, and disabled value_complex = st_keyup( "Limited and Placeholder", max_chars=10, placeholder="Max 10 chars", disabled=False, # Use os.environ.get for dynamic disable key="keyup_complex" ) st.write(f"Complex Input: {value_complex}")
Debug
Known issues
gotchaThe `disabled` argument did not update dynamically in versions prior to `0.3.0`, meaning its initial state would persist even if changed programmatically. This was fixed in `v0.3.0`.
fix
Upgrade to `streamlit-keyup` version `0.3.0` or newer to ensure the `disabled` state updates dynamically.
affects: <0.3.0
gotchaCompatibility issues can arise with specific Streamlit versions. For example, `v0.2.4` addressed a rendering issue with Streamlit `1.32.2`.
fix
Ensure you are using `streamlit-keyup` `v0.2.4` or newer for compatibility with Streamlit `1.32.2` and subsequent versions. Always test component behavior after Streamlit upgrades.
affects: <0.2.4
gotchaThe `key` parameter is essential for Streamlit components to maintain their state across reruns. While `streamlit-keyup` generates a default key if none is provided, explicitly setting unique keys for each `st_keyup` instance is a best practice to prevent unexpected behavior and component state collisions.
fix
Always provide a unique `key` argument for each `st_keyup` instance in your application (e.g., `key="my_unique_input_1"`).
affects: All versions
deprecatedNew arguments like `max_chars`, `type`, `placeholder`, `disabled`, `label_visibility` were introduced in `v0.2.0`, and `on_change` in `v0.1.8`. While not strictly breaking, code written for older versions will not leverage these new functionalities. Review your usage if upgrading from significantly older versions.
fix
Update your `st_keyup` calls to include the new arguments where appropriate to utilize the enhanced functionality, especially for `max_chars`, `placeholder`, and `disabled`.
affects: <0.2.0 for most, <0.1.8 for on_change
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'streamlit_keyup'
The `streamlit-keyup` package has not been installed in your Python environment or is not accessible.
fix
Install the package using pip: `pip install streamlit-keyup`
NameError: name 'st_keyup' is not defined
The `st_keyup` function was called without being properly imported from the `streamlit_keyup` library.
fix
Import `st_keyup` from `streamlit_keyup` before using it: `from streamlit_keyup import st_keyup`
streamlit.errors.StreamlitAPIException: Every widget must have a unique key.
When using multiple instances of `st_keyup`, or if `st_keyup` is within a loop or conditional block, Streamlit requires a unique `key` parameter for each instance to maintain its state.
fix
Provide a unique string value for the `key` parameter to each `st_keyup` call: `st_keyup('Enter text', key='my_unique_key')`
TypeError: expected string or bytes-like object
The `value` parameter for `st_keyup` expects a string, but a non-string type (e.g., integer, float, list) was provided as its initial value.
fix
Ensure the value passed to the `value` parameter is always a string: `st_keyup('Enter text', value=str(my_numeric_variable))`
Upgrade
Version history
0.3.0latest on PyPI · released Jan 2, 2025
Audit
Dependencies
streamlitrequiredstreamlit-keyup is a custom component built for Streamlit applications.
Agent activity
4 hits · last 30 days
node
4
Resources
streamlit-keyup — pip install streamlit-keyup · libregistry