st.metric(label, value, delta=None, delta_color='normal')
The header or Title for the metric
value (int, float, str, or None)
Value of the metric. None is rendered as a long dash.
delta (int, float, str, or None)
Indicator of how the metric changed, rendered with an arrow below the metric. If delta is negative (int/float) or starts with a minus sign (str), the arrow points down and the text is red; else the arrow points up and the text is green. If None (default), no delta indicator is shown.
If "normal" (default), the delta indicator is shown as described above. If "inverse", it is red when positive and green when negative. This is useful when a negative change is considered good, e.g. if cost decreased. If "off", delta is shown in gray regardless of its value.
Still have questions?
Our forums are full of helpful information and Streamlit experts.