✨ Streamlit Elements - Build draggable and resizable dashboards with Material UI, Nivo charts, and more!

Hello, I roughly understand what you mean. I have tried to solve the problem using your code

from streamlit_elements import elements, mui

def create_email_preview_page(*a):
    print(a)

def create_email(content_container, videoTitle, index, videos, val):
        return lambda: create_email_preview_page(content_container, videoTitle, index, videos, val)

def create_section_email_previews(videos, content_container):
    for index, video in enumerate(videos):
        val = index
        # create mui card
        mui.Card(
            mui.CardHeader(
                title= mui.Typography(video['videoTitle'], variant="h6", sx={"textAlign": "center"}),
            ),
            mui.CardMedia(
                image=video['thumbnailUrl'],
                component="img",
                sx={"maxHeight": "100%", "maxWidth": "100%", "width": "unset", },
                width=None
            ),
            mui.CardActions(
                mui.Button("View Email", variant="contained", color="primary", onClick=create_email(content_container, videos[index]['videoTitle'], index, videos, val))
                ),
            sx={"width": "30%", 'display': 'flex', 'flexDirection': 'column', 'justifyContent': 'center', 'alignItems': 'center', 'margin': '1rem 0', 'paddingBottom': '1rem'},
        )

with elements(key='test'):
    content_container = '123'
    videos = [{'videoTitle': 'test', 'thumbnailUrl': 'https://images-na.ssl-images-amazon.com/images/G/01/AmazonExports/Events/2022/IntlFreeReturns/Fuji_Dash_FreeIntlReturns_1X._SY304_CB592173034_.jpg'} for i in range(0, 3)]
    create_section_email_previews(videos, content_container)