does not display properly inside expander

Hello everyone!

I’m trying to display a map inside a collapsable element, so it can be show/hidden at any point. The problem i’m facing is that when the map is in the expander it has a small size and dots corresponding to latitude and longitude are not displayed.
Here you can find a minimal code to reproduce the issue, if the expander line is commented everything works fine

import streamlit as st
import pandas as pd
d = {"lat": [40.781243], "lon":[-73.968432]}

df = pd.DataFrame.from_dict(d)

with st.expander("map"):, size=2)

Is this a known issue? Are there ways to fix it? Thanks!

Try adding use_container_width=True, size=2, use_container_width=True)

I can replicate the issue with Streamlit 1.30.0. Passing use_container_width=False fixed it for me.

Definitely seems to be a buggy behavior, so I submitted it here is narrowr inside expander unless another map is added · Issue #8004 · streamlit/streamlit · GitHub

Hello and thanks for your reply! Yes I’ve managed to fix it with use_container_width=False. Thanks for opening the issue on github and for your help :slight_smile: