-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Summary
Since Streamlit 0.83, all the interactive widgets (except for streamlit.radio) outputs a <label> element for the widget even if the label value is an empty string. Before 0.83, setting a widget's label to an empty string left out the <label> element.
The current behaviour results in unwanted vertical whitespace before a widget for empty labels.
Steps to reproduce
Code snippet:
import streamlit as st
for widget in (st.text_input, st.number_input, st.date_input, st.time_input, st.slider, st.color_picker, st.text_area):
st.subheader(widget.__name__)
c1, c2 = st.beta_columns(2)
with c1:
widget("Label")
with c2:
widget("")
for widget in (st.selectbox, st.radio, st.multiselect, st.select_slider):
st.subheader(widget.__name__)
c1, c2 = st.beta_columns(2)
with c1:
widget("Label", ["A", "B", "C"])
with c2:
widget("", ["A", "B", "C"])The code snippet shows the differences for all the interactive widget. But, here's a select screenshot showing the differences between 0.82 and 0.84 for streamlit.selectbox and streamlit.radio. In Streamlit 0.84, only streamlit.radio works the same as before. Everything else outputs empty <label> elements.
Streamlit 0.82:
Streamlit 0.84:
Expected behavior:
All the widgets should omit outputting labels if the label argument is an empty string.
Actual behavior:
The streamlit.radio widget is the only one that does not output empty labels.
Is this a regression?
The current behaviour was introduced in Streamlit 0.83.
Debug info
- Streamlit version: Streamlit, version 0.84.2
- Python version: Python 3.8.11
- Using Conda? PipEnv? PyEnv? Pex? Just pip
- OS version: Debian buster (in a python:3.8 container)
- Browser version: Safari 14.1 on macOS Mojave 10.14.6
Additional information
None.

