Skip to content

Add documentation for st.status #783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions content/library/api/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,20 @@ if prompt:
st.write(f"The user has sent: {prompt}")
```

</RefCard>
<RefCard href="/library/api-reference/status/st.status">

<Image pure alt="screenshot" src="/images/api/status.jpg" />

#### Status container

Display output of long-running tasks in a container.

```python
with st.status('Running'):
do_something_slow()
```

</RefCard>
</TileContainer>

Expand Down Expand Up @@ -1458,6 +1472,20 @@ with st.spinner("Please wait..."):
do_something_slow()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.status">

<Image pure alt="screenshot" src="/images/api/status.jpg" />

#### Status container

Display output of long-running tasks in a container.

```python
with st.status('Running'):
do_something_slow()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.toast">

Expand Down
16 changes: 15 additions & 1 deletion content/library/api/chat/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ slug: /library/api-reference/chat

Streamlit provides a few commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately.

`st.chat_message` lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. `st.chat_input` lets you display a chat input widget so the user can type in a message.
`st.chat_message` lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. `st.chat_input` lets you display a chat input widget so the user can type in a message. Remeber to check out `st.status` to display output from long-running processes and external API calls.

<TileContainer>
<RefCard href="/library/api-reference/chat/st.chat_message">
Expand Down Expand Up @@ -40,5 +40,19 @@ if prompt:
st.write(f"The user has sent: {prompt}")
```

</RefCard>
<RefCard href="/library/api-reference/status/st.status">

<Image pure alt="screenshot" src="/images/api/status.jpg" />

#### Status container

Display output of long-running tasks in a container.

```python
with st.status('Running'):
do_something_slow()
```

</RefCard>
</TileContainer>
216 changes: 216 additions & 0 deletions content/library/api/status/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
---
title: Display progress and status
slug: /library/api-reference/status
---

# Display progress and status

Streamlit provides a few methods that allow you to add animation to your
apps. These animations include progress bars, status messages (like
warnings), and celebratory balloons.

<TileContainer>
<RefCard href="/library/api-reference/status/st.progress">

<Image pure alt="screenshot" src="/images/api/progress.jpg" />

#### Progress bar

Display a progress bar.

```python
for i in range(101):
st.progress(i)
do_something_slow()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.spinner">

<Image pure alt="screenshot" src="/images/api/spinner.jpg" />

#### Spinner

Temporarily displays a message while executing a block of code.

```python
with st.spinner("Please wait..."):
do_something_slow()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.status">

<Image pure alt="screenshot" src="/images/api/status.jpg" />

#### Status container

Display output of long-running tasks in a container.

```python
with st.status('Running'):
do_something_slow()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.toast">

<Image pure alt="screenshot" src="/images/api/toast.jpg" />

#### Toast

Briefly displays a toast message in the bottom-right corner.

```python
st.toast('Butter!', icon='🧈')
```

</RefCard>
<RefCard href="/library/api-reference/status/st.balloons">

<Image pure alt="screenshot" src="/images/api/balloons.jpg" />

#### Balloons

Display celebratory balloons!

```python
st.balloons()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.snow">

<Image pure alt="screenshot" src="/images/api/snow.jpg" />

#### Snowflakes

Display celebratory snowflakes!

```python
st.snow()
```

</RefCard>
<RefCard href="/library/api-reference/status/st.error">

<Image pure alt="screenshot" src="/images/api/error.jpg" />

#### Error box

Display error message.

```python
st.error("We encountered an error")
```

</RefCard>
<RefCard href="/library/api-reference/status/st.warning">

<Image pure alt="screenshot" src="/images/api/warning.jpg" />

#### Warning box

Display warning message.

```python
st.warning("Unable to fetch image. Skipping...")
```

</RefCard>
<RefCard href="/library/api-reference/status/st.info">

<Image pure alt="screenshot" src="/images/api/info.jpg" />

#### Info box

Display an informational message.

```python
st.info("Dataset is updated every day at midnight.")
```

</RefCard>
<RefCard href="/library/api-reference/status/st.success">

<Image pure alt="screenshot" src="/images/api/success.jpg" />

#### Success box

Display a success message.

```python
st.success("Match found!")
```

</RefCard>
<RefCard href="/library/api-reference/status/st.exception">

<Image pure alt="screenshot" src="/images/api/exception.jpg" />

#### Exception output

Display an exception.

```python
e = RuntimeError("This is an exception of type RuntimeError")
st.exception(e)
```

</RefCard>
</TileContainer>

<ComponentSlider>

<ComponentCard href="https://github.com/Wirg/stqdm">

<Image pure alt="screenshot" src="/images/api/components/stqdm.jpg" />

#### Stqdm

The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg).

```python
from stqdm import stqdm

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

</ComponentCard>

<ComponentCard href="https://github.com/Socvest/streamlit-custom-notification-box">

<Image pure alt="screenshot" src="/images/api/components/custom-notification-box.jpg" />

#### Custom notification box

A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest).

```python
from streamlit_custom_notification_box import custom_notification_box

styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}}
custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo")
```

</ComponentCard>

<ComponentCard href="https://extras.streamlit.app/">

<Image pure alt="screenshot" src="/images/api/components/extras-emojis.jpg" />

#### Streamlit Extras

A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).

```python
from streamlit_extras.let_it_rain import rain

rain(emoji="🎈", font_size=54,
falling_speed=5, animation_length="infinite",)
```

</ComponentCard>

</ComponentSlider>
Loading