St.toggle label position up

Is there a way to put st.toggle label up toggle like input or selectbox behavior?

Thereโ€™s no in-built option to position the label on top of the toggle at the moment. You can however pass an empty string or hide the label using label_visibility parameter and use st.markdown or st.write to simulate the desired effect as such;

import streamlit as st
# Add this before the toggle button
st.markdown("Activate feature")
on = st.toggle(label="", label_visibility="collapsed")

if on:
    st.write('Feature activated!')

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