Display a metric in big bold font, with an optional indicator of how the metric changed.
Function signature

st.metric(label, value, delta=None, delta_color='normal')

Parameters

label (str)

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.

delta_color (str)

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.

Was this page helpful?

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.