# Input widgets

Source: https://docs.streamlit.io/develop/api-reference/widgets

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

## Button elements

**[Button](https://docs.streamlit.io/develop/api-reference/widgets/st.button)**: Display a button widget.

```python
clicked = st.button("Click me")
```

**[Download button](https://docs.streamlit.io/develop/api-reference/widgets/st.download_button)**: Display a download button widget.

```python
st.download_button("Download file", file)
```

**[Form button](https://docs.streamlit.io/develop/api-reference/execution-flow/st.form_submit_button)**: Display a form submit button. For use with `st.form`.

```python
st.form_submit_button("Sign up")
```

**[Link button](https://docs.streamlit.io/develop/api-reference/widgets/st.link_button)**: Display a link button.

```python
st.link_button("Go to gallery", url)
```

**[Menu button](https://docs.streamlit.io/develop/api-reference/widgets/st.menu_button)**: Display a menu button.

```python
st.menu_button("Export", options=["CSV", "JSON", "PDF"])
```

**[Page link](https://docs.streamlit.io/develop/api-reference/widgets/st.page_link)**: Display a link to another page in a multipage app.

```python
st.page_link("app.py", label="Home", icon="🏠")
st.page_link("pages/profile.py", label="My profile")
```

## Selection elements

**[Checkbox](https://docs.streamlit.io/develop/api-reference/widgets/st.checkbox)**: Display a checkbox widget.

```python
selected = st.checkbox("I agree")
```

**[Color picker](https://docs.streamlit.io/develop/api-reference/widgets/st.color_picker)**: Display a color picker widget.

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

**[Feedback](https://docs.streamlit.io/develop/api-reference/widgets/st.feedback)**: Display a rating or sentiment button group.

```python
st.feedback("stars")
```

**[Multiselect](https://docs.streamlit.io/develop/api-reference/widgets/st.multiselect)**: Display a multiselect widget. The multiselect widget starts as empty.

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

**[Pills](https://docs.streamlit.io/develop/api-reference/widgets/st.pills)**: Display a pill-button selection widget.

```python
st.pills("Tags", ["Sports", "AI", "Politics"])
```

**[Radio](https://docs.streamlit.io/develop/api-reference/widgets/st.radio)**: Display a radio button widget.

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

**[Segmented control](https://docs.streamlit.io/develop/api-reference/widgets/st.segmented_control)**: Display a segmented-button selection widget.

```python
st.segmented_control("Filter", ["Open", "Closed", "All"])
```

**[Select slider](https://docs.streamlit.io/develop/api-reference/widgets/st.select_slider)**: Display a slider widget to select items from a list.

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

**[Selectbox](https://docs.streamlit.io/develop/api-reference/widgets/st.selectbox)**: Display a select widget.

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

**[Toggle](https://docs.streamlit.io/develop/api-reference/widgets/st.toggle)**: Display a toggle widget.

```python
activated = st.toggle("Activate")
```

## Numeric input elements

**[Number input](https://docs.streamlit.io/develop/api-reference/widgets/st.number_input)**: Display a numeric input widget.

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

**[Slider](https://docs.streamlit.io/develop/api-reference/widgets/st.slider)**: Display a slider widget.

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

## Date and time input elements

**[Date input](https://docs.streamlit.io/develop/api-reference/widgets/st.date_input)**: Display a date input widget.

```python
date = st.date_input("Your birthday")
```

**[Datetime input](https://docs.streamlit.io/develop/api-reference/widgets/st.datetime_input)**: Display a datetime input widget.

```python
datetime = st.datetime_input("Schedule your event")
```

**[Time input](https://docs.streamlit.io/develop/api-reference/widgets/st.time_input)**: Display a time input widget.

```python
time = st.time_input("Meeting time")
```

## Text input elements

**[Text input](https://docs.streamlit.io/develop/api-reference/widgets/st.text_input)**: Display a single-line text input widget.

```python
name = st.text_input("First name")
```

**[Text area](https://docs.streamlit.io/develop/api-reference/widgets/st.text_area)**: Display a multi-line text input widget.

```python
text = st.text_area("Text to translate")
```

**[Chat input](https://docs.streamlit.io/develop/api-reference/chat/st.chat_input)**: Display a chat input widget.

```python
prompt = st.chat_input("Say something")
if prompt:
    st.write(f"The user has sent: {prompt}")
```

## Other input elements

**[Pagination](https://docs.streamlit.io/develop/api-reference/widgets/st.pagination)**: Display a pagination widget.

```python
page = st.pagination(10)
```

**[Audio input](https://docs.streamlit.io/develop/api-reference/widgets/st.audio_input)**: Display a widget that allows users to record with their microphone.

```python
speech = st.audio_input("Record a voice message")
```

**[Data editor](https://docs.streamlit.io/develop/api-reference/data/st.data_editor)**: Display a data editor widget.

```python
edited = st.data_editor(df, num_rows="dynamic")
```

**[File uploader](https://docs.streamlit.io/develop/api-reference/widgets/st.file_uploader)**: Display a file uploader widget.

```python
data = st.file_uploader("Upload a CSV")
```

**[Camera input](https://docs.streamlit.io/develop/api-reference/widgets/st.camera_input)**: Display a widget that allows users to upload images directly from a camera.

```python
image = st.camera_input("Take a picture")
```
