I’d love to do projects involving visualizations that change dynamically as you type.
Is there any way to get the text_area or text_input widgets to stream their text to Python as they’re being modified without requiring the user to explicitly press enter or ctrl+enter?
I see this as one of the fundamental challenges of the Streamlit architecture of running the script top to bottom. I believe this architecture would make it too slow in practice compared to other analytics apps frameworks that use callbacks and updates small parts of the application.
Would love to learn and be proved wrong.
@DavidHolz. I belive the way to currently go is a creating a Custom Streamlit Compont and see if that would work satisfactorily.
I second @Marc on this, a Streamlit component bringing a text input with a onchange event handler should do. I tried to condense all of component creation in this tutorial if you want to have a try poking with frontend, or the template if you already have small experience with JS/Node.
Could not find a post about this in the forum, but I regularly see this on Twitter so I think it would deserve its own thread
If you want to test this refresh as you type workflow with an already existing solution, you could try to use my Ace Editor component. It updates the app every 200ms as you type (this value is hardcoded in my component code for now though).
If results are good, I suggest you follow @andfanilo’s tutorial to build a simpler/lighter component for your purpose.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.