Skip to content

Commit a7a8c14

Browse files
Add documentation for st.status (#783)
* Create st.status page * Update API cards & docstrings * Update st.status API card summary * Add st.status to chat elements in API index
1 parent b2877f0 commit a7a8c14

File tree

9 files changed

+12304
-199
lines changed

9 files changed

+12304
-199
lines changed

content/library/api/api-reference.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,20 @@ if prompt:
14241424
st.write(f"The user has sent: {prompt}")
14251425
```
14261426

1427+
</RefCard>
1428+
<RefCard href="/library/api-reference/status/st.status">
1429+
1430+
<Image pure alt="screenshot" src="/images/api/status.jpg" />
1431+
1432+
#### Status container
1433+
1434+
Display output of long-running tasks in a container.
1435+
1436+
```python
1437+
with st.status('Running'):
1438+
do_something_slow()
1439+
```
1440+
14271441
</RefCard>
14281442
</TileContainer>
14291443

@@ -1458,6 +1472,20 @@ with st.spinner("Please wait..."):
14581472
do_something_slow()
14591473
```
14601474

1475+
</RefCard>
1476+
<RefCard href="/library/api-reference/status/st.status">
1477+
1478+
<Image pure alt="screenshot" src="/images/api/status.jpg" />
1479+
1480+
#### Status container
1481+
1482+
Display output of long-running tasks in a container.
1483+
1484+
```python
1485+
with st.status('Running'):
1486+
do_something_slow()
1487+
```
1488+
14611489
</RefCard>
14621490
<RefCard href="/library/api-reference/status/st.toast">
14631491

content/library/api/chat/chat.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ slug: /library/api-reference/chat
77

88
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.
99

10-
`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.
10+
`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.
1111

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

43+
</RefCard>
44+
<RefCard href="/library/api-reference/status/st.status">
45+
46+
<Image pure alt="screenshot" src="/images/api/status.jpg" />
47+
48+
#### Status container
49+
50+
Display output of long-running tasks in a container.
51+
52+
```python
53+
with st.status('Running'):
54+
do_something_slow()
55+
```
56+
4357
</RefCard>
4458
</TileContainer>

content/library/api/status/index.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
---
2+
title: Display progress and status
3+
slug: /library/api-reference/status
4+
---
5+
6+
# Display progress and status
7+
8+
Streamlit provides a few methods that allow you to add animation to your
9+
apps. These animations include progress bars, status messages (like
10+
warnings), and celebratory balloons.
11+
12+
<TileContainer>
13+
<RefCard href="/library/api-reference/status/st.progress">
14+
15+
<Image pure alt="screenshot" src="/images/api/progress.jpg" />
16+
17+
#### Progress bar
18+
19+
Display a progress bar.
20+
21+
```python
22+
for i in range(101):
23+
st.progress(i)
24+
do_something_slow()
25+
```
26+
27+
</RefCard>
28+
<RefCard href="/library/api-reference/status/st.spinner">
29+
30+
<Image pure alt="screenshot" src="/images/api/spinner.jpg" />
31+
32+
#### Spinner
33+
34+
Temporarily displays a message while executing a block of code.
35+
36+
```python
37+
with st.spinner("Please wait..."):
38+
do_something_slow()
39+
```
40+
41+
</RefCard>
42+
<RefCard href="/library/api-reference/status/st.status">
43+
44+
<Image pure alt="screenshot" src="/images/api/status.jpg" />
45+
46+
#### Status container
47+
48+
Display output of long-running tasks in a container.
49+
50+
```python
51+
with st.status('Running'):
52+
do_something_slow()
53+
```
54+
55+
</RefCard>
56+
<RefCard href="/library/api-reference/status/st.toast">
57+
58+
<Image pure alt="screenshot" src="/images/api/toast.jpg" />
59+
60+
#### Toast
61+
62+
Briefly displays a toast message in the bottom-right corner.
63+
64+
```python
65+
st.toast('Butter!', icon='🧈')
66+
```
67+
68+
</RefCard>
69+
<RefCard href="/library/api-reference/status/st.balloons">
70+
71+
<Image pure alt="screenshot" src="/images/api/balloons.jpg" />
72+
73+
#### Balloons
74+
75+
Display celebratory balloons!
76+
77+
```python
78+
st.balloons()
79+
```
80+
81+
</RefCard>
82+
<RefCard href="/library/api-reference/status/st.snow">
83+
84+
<Image pure alt="screenshot" src="/images/api/snow.jpg" />
85+
86+
#### Snowflakes
87+
88+
Display celebratory snowflakes!
89+
90+
```python
91+
st.snow()
92+
```
93+
94+
</RefCard>
95+
<RefCard href="/library/api-reference/status/st.error">
96+
97+
<Image pure alt="screenshot" src="/images/api/error.jpg" />
98+
99+
#### Error box
100+
101+
Display error message.
102+
103+
```python
104+
st.error("We encountered an error")
105+
```
106+
107+
</RefCard>
108+
<RefCard href="/library/api-reference/status/st.warning">
109+
110+
<Image pure alt="screenshot" src="/images/api/warning.jpg" />
111+
112+
#### Warning box
113+
114+
Display warning message.
115+
116+
```python
117+
st.warning("Unable to fetch image. Skipping...")
118+
```
119+
120+
</RefCard>
121+
<RefCard href="/library/api-reference/status/st.info">
122+
123+
<Image pure alt="screenshot" src="/images/api/info.jpg" />
124+
125+
#### Info box
126+
127+
Display an informational message.
128+
129+
```python
130+
st.info("Dataset is updated every day at midnight.")
131+
```
132+
133+
</RefCard>
134+
<RefCard href="/library/api-reference/status/st.success">
135+
136+
<Image pure alt="screenshot" src="/images/api/success.jpg" />
137+
138+
#### Success box
139+
140+
Display a success message.
141+
142+
```python
143+
st.success("Match found!")
144+
```
145+
146+
</RefCard>
147+
<RefCard href="/library/api-reference/status/st.exception">
148+
149+
<Image pure alt="screenshot" src="/images/api/exception.jpg" />
150+
151+
#### Exception output
152+
153+
Display an exception.
154+
155+
```python
156+
e = RuntimeError("This is an exception of type RuntimeError")
157+
st.exception(e)
158+
```
159+
160+
</RefCard>
161+
</TileContainer>
162+
163+
<ComponentSlider>
164+
165+
<ComponentCard href="https://github.com/Wirg/stqdm">
166+
167+
<Image pure alt="screenshot" src="/images/api/components/stqdm.jpg" />
168+
169+
#### Stqdm
170+
171+
The simplest way to handle a progress bar in streamlit app. Created by [@Wirg](https://github.com/Wirg).
172+
173+
```python
174+
from stqdm import stqdm
175+
176+
for _ in stqdm(range(50)):
177+
sleep(0.5)
178+
```
179+
180+
</ComponentCard>
181+
182+
<ComponentCard href="https://github.com/Socvest/streamlit-custom-notification-box">
183+
184+
<Image pure alt="screenshot" src="/images/api/components/custom-notification-box.jpg" />
185+
186+
#### Custom notification box
187+
188+
A custom notification box with the ability to close it out. Created by [@Socvest](https://github.com/Socvest).
189+
190+
```python
191+
from streamlit_custom_notification_box import custom_notification_box
192+
193+
styles = {'material-icons':{'color': 'red'}, 'text-icon-link-close-container': {'box-shadow': '#3896de 0px 4px'}, 'notification-text': {'':''}, 'close-button':{'':''}, 'link':{'':''}}
194+
custom_notification_box(icon='info', textDisplay='We are almost done with your registration...', externalLink='more info', url='#', styles=styles, key="foo")
195+
```
196+
197+
</ComponentCard>
198+
199+
<ComponentCard href="https://extras.streamlit.app/">
200+
201+
<Image pure alt="screenshot" src="/images/api/components/extras-emojis.jpg" />
202+
203+
#### Streamlit Extras
204+
205+
A library with useful Streamlit extras. Created by [@arnaudmiribel](https://github.com/arnaudmiribel/).
206+
207+
```python
208+
from streamlit_extras.let_it_rain import rain
209+
210+
rain(emoji="🎈", font_size=54,
211+
falling_speed=5, animation_length="infinite",)
212+
```
213+
214+
</ComponentCard>
215+
216+
</ComponentSlider>

0 commit comments

Comments
 (0)