Change size of metrics

Hi, I want to do an app where i can visualize some metrics, but i need them to be bigger than they are when using st.metric(). Is there a way to do this?
I don´t have any code to show, as I have no idea how to face this problem.
Thanks.

Hi @Belen_Espino!

In general, things like controlling sizes can’t be done directly through streamlit, but you can put in some custom CSS with st.markdown. If you look around on the forum, there are a number of issues related to setting font size.

Here’s an example of how you might accomplish what you’re looking for:

import streamlit as st

st.markdown(
    """
<style>
[data-testid="stMetricValue"] {
    font-size: 100px;
}
</style>
""",
    unsafe_allow_html=True,
)

st.metric(label="Metric", value=1000, delta=100)

Thanks! I made something similar with plotly express, but i will try this too

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.