I am trying to develop a new custom component, where my frontend will just be a HTML+Javascript file whose location will be passed using the “path” argument of the “declare_component” API.
I am not a react developer. Just a simple HTML+Javascript solution.
Now, I want to develop a bi-directional component and want to use the “Streamlit.setComponentValue()” function to return value from Javascript to Python.
The “Streamlit” object is no where to be seen (I run : streamlit run app.py). The console log shows this as undefined reference.
I understand that this comes from “streamlit-components-lib.js” file. I read @blackary 's blog where he recommends a cookie-cutter which installs this js file.
Does this “js” file not come automatically with the streamlit installation?
I’ve been trying hard for 2 days to get this done. I am close to running down the street, with ruffled hair, baffling everyone with what is a good way to develop a streamlit component?.. Please tell me dear… Please… Why is the documentation and videos not helping simple developers like me… Tell me dear…
I created a component to construct and/or edit networkx graphs. I just copied the streamlit-component-lib.js from Blackary’s project and used it. Not sure if thats the right way to do this.
I am afraid to contribute this as a component because I am not sure if I am developing in a right way that is “streamlit” compliant.
So, any help most welcome!
If you come up with something that seems useful, and works, feel free to post it here on the forum to get feedback – there are lots of different ways people develop components, and not just one right way, so if it works, it will be a great contribution to the community!
Thanks for your response. The official link does not have the JS file… I think they assume that the HTML will be served from “node.js”.
But not all environments are conducive for this.
Integrating a simple JS file and serving the file statically through the “path” argument of “declare_component” is the easiest method for many developers.
But, I could not find any example of this in the documentation.
I struggled to figure my way out. Your cookiecutter thing was straightforward and very useful. The official videos could include a link to that and make it easier for developers to develop components.
As far as the work I am doing, it is an interactive graph editor – just blooming. I need to solidify it a bit before posting here. Will do once it is in a shareable state. Thanks for your encouragement!
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.