CCV2 Embedded apps for concepts#1431
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This reverts commit 23b1034.
301fdeb to
c63a5b7
Compare
| with open(component_dir / "button.css", "r") as f: | ||
| CSS = f.read() | ||
| with open(component_dir / "button.html", "r") as f: | ||
| HTML = f.read() | ||
| with open(component_dir / "button.js", "r") as f: | ||
| JS = f.read() | ||
| return HTML, CSS, JS |
There was a problem hiding this comment.
note: I am a little worried about using this as a pattern in our docs. While it is valid, there are some drawbacks. One notable drawback I've seen is that it doesn't always detect a file change when the underlying files change, so refreshing the page leads to a stale component. One would have to restart the streamlit server in order for the changes to be picked up.
While it might be a bit uglier, putting the file content in Python strings might be better overall.
We have considered expanding the API in Streamlit to allow for Paths to be passed directly to the html/css/js arguments of st.components.v2.component(), but haven't implemented that yet.
There was a problem hiding this comment.
It would be delightful if we could support local paths for non-packaged components. That would definitley clean up the docs for me.
Merge activity
|

📚 Context
This PR adds the source code for embedded examples in the Custom Components V2 docs, introduced later in this stack.
🧠 Description of Changes
Current:
No examples or documentation existed for the new components v2 API.
Revised:
Added complete component examples demonstrating various patterns and capabilities:
• Basic Examples:
• Interactive Components:
• Display Components:
• Component Architecture:
__init__.py, separate CSS/HTML/JS files)• Advanced Features:
💥 Impact
Size:
🌐 References
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.