Input widgets

With widgets, Streamlit allows you to bake interactivity directly into your apps with buttons, sliders, text inputs, and more.

screenshot

Button

Display a button widget.

clicked = st.button("Click me")
screenshot

Download button

Display a download button widget.

st.download_button("Download file", file)
screenshot

Checkbox

Display a checkbox widget.

selected = st.checkbox("I agree")
screenshot

Radio

Display a radio button widget.

choice = st.radio("Pick one", ["cats", "dogs"])
screenshot

Selectbox

Display a select widget.

choice = st.selectbox("Pick one", ["cats", "dogs"])
screenshot

Multiselect

Display a multiselect widget. The multiselect widget starts as empty.

choices = st.multiselect("Buy", ["milk", "apples", "potatoes"])
screenshot

Slider

Display a slider widget.

number = st.slider("Pick a number", 0, 100)
screenshot

Select slider

Display a slider widget to select items from a list.

size = st.select_slider("Pick a size", ["S", "M", "L"])
screenshot

Text input

Display a single-line text input widget.

name = st.text_input("First name")
screenshot

Number input

Display a numeric input widget.

choice = st.number_input("Pick a number", 0, 10)
screenshot

Text area

Display a multi-line text input widget.

text = st.text_area("Text to translate")
screenshot

Date input

Display a date input widget.

date = st.date_input("Your birthday")
screenshot

Time input

Display a time input widget.

time = st.time_input("Meeting time")
screenshot

File uploader

Display a file uploader widget.

data = st.file_uploader("Upload a CSV")
screenshot

Camera input

Display a widget that allows users to upload images directly from a camera.

image = st.camera_input("Take a picture")
screenshot

Color picker

Display a color picker widget.

color = st.color_picker("Pick a color")

Third-party components

These are featured components created by our lovely community. If you don't see what you're looking for, check out our Components Hub app and Streamlit Extras for more examples and inspiration!

screenshot

Streamlit Elements

Create a draggable and resizable dashboard in Streamlit. Created by @okls.

from streamlit_elements import elements, mui, html

with elements("new_element"):
  mui.Typography("Hello world")
screenshot

Tags

Add tags to your Streamlit apps. Created by @gagan3012.

from streamlit_tags import st_tags

st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'],
suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1')
screenshot

Stqdm

The simplest way to handle a progress bar in streamlit app. Created by @Wirg.

from stqdm import stqdm

for _ in stqdm(range(50)):
    sleep(0.5)

Was this page helpful?

editSuggest edits
forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.