Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hide the arrow in the delta of st.metric #4775

@Nemecsek

Description

@Nemecsek

st.metrics can be a string: in this case it shouldn't show the arrow up/down:

st.metrics("label", value=20, delta="Going up") is rendered as ↑ Going up

Currently the down arrow is shown when the string begins with minus, but the minus itself is not removed from the visualized text:
st.metrics("label", value=10, delta="Going down") is rendered as ↑ Going down
st.metrics("label", value=10, delta="-Going down") is rendered as ↓ -Going down

It would be more intuitive to remove the arrow in case of a string parameter, and left to the user to add it to the string just in case of need. This change would also allow to use the delta text as an extra field to add additional info not strictly related to value changes such as in:

st.metrics("label", value=10, delta="Value is nominal").


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

Views

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.metricRelated to the `st.metric` elementtype:enhancementRequests for feature enhancements or new features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions