Space between radio buttons

Hi All
I have a streamit based program which shows a heading and 3 options as radio buttons as below:
options = [“A”, “B”, “C”]
options = [“”] + options
source_var = st.radio(“Select the appropriate option:”, options, index=0)

Now, when I execute it, it is giving radio buttons with options but only problem I have is that these radio buttons appear one after another in different line but the SPACES between two lines is very less…I want at least 2 line gap between any two radio buttons.

Current image:
Select the appropriate option:
o A
o B
o C

I want this to appear with extra space, like:
Select the appropriate option:
o A

o B

o C

You can modify the CSS gap property of the radio options:

import streamlit as st

st.markdown("""
    <style>
    [role=radiogroup]{
        gap: 3rem;
    }
    </style>
    """,unsafe_allow_html=True)

st.markdown("## Vertical gap for `st.radio`")
st.radio("Options", options=[f"Option {i}" for i in range(1,5)])

Result:

Also check:

2 Likes

Amazing. It worked as expected. Thank you so much!!