St.form - rounded shape

How could be a rounded shape made for st.form as show on the picture:

You can inject some CSS to personalize how the form is displayed. Check #3 in this blogpost 10 most common explanations on the Streamlit forum for a nice explanation.

import streamlit as st
st.markdown(
    """
    <style>
    [data-testid="stForm"]{
    border: 2px solid red;
    border-radius: 10px;
    box-shadow: 5px 5px 5px pink;
    }
    </style>
    """, unsafe_allow_html=True
)

with st.form("my_form"):
    "# Form"
    txt_input_1 = st.text_input("Text input 1")
    cols = st.columns(2)

    with cols[0]:
        txt_input_1 = st.text_input("Text input 2")
    
    with cols[1]:
        val_slider = st.slider("Slider", 0, 100, 10)
    
    st.form_submit_button("Submit!", use_container_width=True, type="primary")
2 Likes

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