-
Notifications
You must be signed in to change notification settings - Fork 4k
Docs for release 1.40.0 #9765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs for release 1.40.0 #9765
Conversation
| Should be set for SVG images, as they have no default image width. | ||
| Image width. If this is ``None`` (default), Streamlit will use the | ||
| image's native width, up to the width of the parent container. | ||
| When using an SVG image without a default width, you should declare |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using an SVG image without a default width
this sounds like an SVG image can have a default width. Is this true? If not, I would probably rewrite it to When using an SVG image (which doesn't have a default width), ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Viewport? ViewBox, I mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, do we honor that in Streamlit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the little test I ran:
import streamlit as st
dim = st.number_input("Height and Width", min_value=100, max_value=2000)
SVG = f"""<svg width="{dim}" height="{dim}" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M255.968 288.494L166.211 241.067L10.4062 158.753C10.2639 158.611 9.97951 158.611 9.83728 158.611C4.14838 155.909 -1.68275 161.596 0.450591 167.283L79.8393 369.685L79.8535 369.728C79.9388 369.927 80.0099 370.126 80.0953 370.325C83.3522 377.874 90.4633 382.537 98.2002 384.371C98.8544 384.513 99.3225 384.643 100.108 384.799C100.89 384.973 101.983 385.21 102.922 385.281C103.078 385.295 103.221 385.295 103.377 385.31H103.491C103.605 385.324 103.718 385.324 103.832 385.338H103.989C104.088 385.352 104.202 385.352 104.302 385.352H104.486C104.6 385.366 104.714 385.366 104.828 385.366L167.175 392.161C226.276 398.602 285.901 398.602 345.002 392.161L407.35 385.366C408.558 385.366 409.739 385.31 410.877 385.196C411.246 385.153 411.602 385.111 411.958 385.068C412 385.054 412.057 385.054 412.1 385.039C412.342 385.011 412.583 384.968 412.825 384.926C413.181 384.883 413.536 384.812 413.892 384.741C414.603 384.585 414.926 384.471 415.891 384.139C416.856 383.808 418.458 383.228 419.461 382.745C420.464 382.261 421.159 381.798 421.999 381.272C423.037 380.618 424.024 379.948 425.025 379.198C425.457 378.868 425.753 378.656 426.066 378.358L425.895 378.258L255.968 288.494Z" fill="#FF2B2B"/>
<path d="M501.789 158.755H501.647L345.784 241.07L432.426 370.058L511.616 167.285V167.001C513.607 161.03 507.492 155.627 501.789 158.755" fill="#7D353B"/>
<path d="M264.274 119.615C260.292 113.8 251.616 113.8 247.776 119.615L166.211 241.068L255.968 288.495L426.067 378.357C427.135 377.312 427.991 376.293 428.897 375.217C430.177 373.638 431.372 371.947 432.424 370.056L345.782 241.068L264.274 119.615Z" fill="#BD4043"/>
</svg>"""
with open("dynamic_logo.svg", "w") as f:
f.write(SVG)
st.image("dynamic_logo.svg")There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the ViewBox didn't didn't set the width itself as it was set appropriately for the drawing coordinates, but because there was a ViewBox, I could just set the width/height and st.image used it.
raethlein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the great updates 🙂
|
Good to merge if my example for SVG is correct. Thanks! (I can't merge my own PRs in streamlit/streamlit.) |
## Describe your changes Docstring updates for release 1.40.0. * Added `st.pills` * Added `st.segmented_control` * Updated `st.text` * Update `st.image` (width) * Added examples for `st.navigation` * Updated `st.markdown` and label descriptions: (`:streamlit:`, arrows, inline images) * Cleaned up some parameter descriptions for consistency ## Testing Plan None. Docstrings only. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
## Describe your changes Docstring updates for release 1.40.0. * Added `st.pills` * Added `st.segmented_control` * Updated `st.text` * Update `st.image` (width) * Added examples for `st.navigation` * Updated `st.markdown` and label descriptions: (`:streamlit:`, arrows, inline images) * Cleaned up some parameter descriptions for consistency ## Testing Plan None. Docstrings only. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Describe your changes
Docstring updates for release 1.40.0.
st.pillsst.segmented_controlst.textst.image(width)st.navigationst.markdownand label descriptions: (:streamlit:, arrows, inline images)Testing Plan
None. Docstrings only.
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.