streamlit-nightly 1.33.1.dev20240430__py2.py3-none-any.whl → 1.33.1.dev20240501__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/commands/page_config.py +34 -6
- streamlit/elements/alert.py +64 -20
- streamlit/elements/dialog_decorator.py +56 -31
- streamlit/elements/empty.py +3 -3
- streamlit/elements/form.py +2 -2
- streamlit/elements/heading.py +9 -3
- streamlit/elements/layouts.py +31 -23
- streamlit/elements/lib/column_types.py +3 -1
- streamlit/elements/markdown.py +8 -4
- streamlit/elements/media.py +12 -12
- streamlit/elements/metric.py +3 -1
- streamlit/elements/progress.py +3 -1
- streamlit/elements/toast.py +20 -6
- streamlit/elements/widgets/button.py +22 -14
- streamlit/elements/widgets/camera_input.py +3 -1
- streamlit/elements/widgets/chat.py +26 -9
- streamlit/elements/widgets/checkbox.py +10 -6
- streamlit/elements/widgets/color_picker.py +5 -3
- streamlit/elements/widgets/file_uploader.py +4 -2
- streamlit/elements/widgets/multiselect.py +7 -5
- streamlit/elements/widgets/number_input.py +6 -4
- streamlit/elements/widgets/radio.py +6 -4
- streamlit/elements/widgets/select_slider.py +10 -8
- streamlit/elements/widgets/selectbox.py +8 -6
- streamlit/elements/widgets/slider.py +11 -9
- streamlit/elements/widgets/text_widgets.py +9 -5
- streamlit/elements/widgets/time_widgets.py +13 -9
- streamlit/runtime/caching/cache_utils.py +34 -3
- streamlit/runtime/state/query_params_proxy.py +23 -13
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/RECORD +35 -35
- {streamlit_nightly-1.33.1.dev20240430.data → streamlit_nightly-1.33.1.dev20240501.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/top_level.txt +0 -0
streamlit/elements/media.py
CHANGED
@@ -122,10 +122,9 @@ class MediaMixin:
|
|
122
122
|
loop: bool
|
123
123
|
Whether the audio should loop playback.
|
124
124
|
autoplay: bool
|
125
|
-
Whether the audio should start playing automatically.
|
126
|
-
Browsers will not autoplay audio files if the
|
127
|
-
|
128
|
-
Defaults to False.
|
125
|
+
Whether the audio file should start playing automatically. This is
|
126
|
+
``False`` by default. Browsers will not autoplay audio files if the
|
127
|
+
user has not interacted with the page by clicking somewhere.
|
129
128
|
|
130
129
|
Examples
|
131
130
|
--------
|
@@ -227,7 +226,7 @@ class MediaMixin:
|
|
227
226
|
one of the following:
|
228
227
|
|
229
228
|
* ``None`` (default): The element plays from the beginning.
|
230
|
-
* An``int`` or ``float`` specifying the time in seconds. ``float``
|
229
|
+
* An ``int`` or ``float`` specifying the time in seconds. ``float``
|
231
230
|
values are rounded down to whole seconds.
|
232
231
|
* A string specifying the time in a format supported by `Pandas'
|
233
232
|
Timedelta constructor <https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html>`_,
|
@@ -275,14 +274,15 @@ class MediaMixin:
|
|
275
274
|
loop: bool
|
276
275
|
Whether the video should loop playback.
|
277
276
|
autoplay: bool
|
278
|
-
Whether the video should start playing automatically.
|
279
|
-
Browsers will not autoplay
|
280
|
-
the
|
281
|
-
To enable autoplay without user interaction, you
|
282
|
-
|
277
|
+
Whether the video should start playing automatically. This is
|
278
|
+
``False`` by default. Browsers will not autoplay unmuted videos
|
279
|
+
if the user has not interacted with the page by clicking somewhere.
|
280
|
+
To enable autoplay without user interaction, you must also set
|
281
|
+
``muted=True``.
|
283
282
|
muted: bool
|
284
|
-
Whether the video should play with the audio silenced. This
|
285
|
-
|
283
|
+
Whether the video should play with the audio silenced. This is
|
284
|
+
``False`` by default. Use this in conjunction with ``autoplay=True``
|
285
|
+
to enable autoplay without user interaction.
|
286
286
|
|
287
287
|
Example
|
288
288
|
-------
|
streamlit/elements/metric.py
CHANGED
@@ -81,8 +81,10 @@ class MetricMixin:
|
|
81
81
|
|
82
82
|
* Colored text and background colors for text, using the syntax
|
83
83
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
84
|
-
respectively
|
84
|
+
respectively. ``color`` must be replaced with any of the following
|
85
85
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
86
|
+
For example, you can use ``:orange[your text here]`` or
|
87
|
+
``:blue-background[your text here]``.
|
86
88
|
|
87
89
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
88
90
|
Display unsupported elements as literal characters by
|
streamlit/elements/progress.py
CHANGED
@@ -119,8 +119,10 @@ class ProgressMixin:
|
|
119
119
|
|
120
120
|
* Colored text and background colors for text, using the syntax
|
121
121
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
122
|
-
respectively
|
122
|
+
respectively. ``color`` must be replaced with any of the following
|
123
123
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
124
|
+
For example, you can use ``:orange[your text here]`` or
|
125
|
+
``:blue-background[your text here]``.
|
124
126
|
|
125
127
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
126
128
|
Display unsupported elements as literal characters by
|
streamlit/elements/toast.py
CHANGED
@@ -69,13 +69,27 @@ class ToastMixin:
|
|
69
69
|
|
70
70
|
* Colored text and background colors for text, using the syntax
|
71
71
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
72
|
-
respectively
|
72
|
+
respectively. ``color`` must be replaced with any of the following
|
73
73
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
For example, you can use ``:orange[your text here]`` or
|
75
|
+
``:blue-background[your text here]``.
|
76
|
+
|
77
|
+
icon : str, None
|
78
|
+
An optional emoji or icon to display next to the alert. If ``icon``
|
79
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
80
|
+
string, the following options are valid:
|
81
|
+
|
82
|
+
* A single-character emoji. For example, you can set ``icon="🚨"``
|
83
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
84
|
+
|
85
|
+
* An icon from the Material Symbols library (outlined style) in the
|
86
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
87
|
+
of the icon in snake case.
|
88
|
+
|
89
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
90
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
91
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
92
|
+
font library.
|
79
93
|
|
80
94
|
Example
|
81
95
|
-------
|
@@ -99,8 +99,10 @@ class ButtonMixin:
|
|
99
99
|
|
100
100
|
* Colored text and background colors for text, using the syntax
|
101
101
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
102
|
-
respectively
|
102
|
+
respectively. ``color`` must be replaced with any of the following
|
103
103
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
104
|
+
For example, you can use ``:orange[your text here]`` or
|
105
|
+
``:blue-background[your text here]``.
|
104
106
|
|
105
107
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
106
108
|
Display unsupported elements as literal characters by
|
@@ -140,10 +142,10 @@ class ButtonMixin:
|
|
140
142
|
>>> import streamlit as st
|
141
143
|
>>>
|
142
144
|
>>> st.button("Reset", type="primary")
|
143
|
-
>>> if st.button(
|
144
|
-
... st.write(
|
145
|
+
>>> if st.button("Say hello"):
|
146
|
+
... st.write("Why hello there")
|
145
147
|
... else:
|
146
|
-
... st.write(
|
148
|
+
... st.write("Goodbye")
|
147
149
|
|
148
150
|
.. output::
|
149
151
|
https://doc-buton.streamlit.app/
|
@@ -219,8 +221,10 @@ class ButtonMixin:
|
|
219
221
|
|
220
222
|
* Colored text and background colors for text, using the syntax
|
221
223
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
222
|
-
respectively
|
224
|
+
respectively. ``color`` must be replaced with any of the following
|
223
225
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
226
|
+
For example, you can use ``:orange[your text here]`` or
|
227
|
+
``:blue-background[your text here]``.
|
224
228
|
|
225
229
|
Unsupported elements are unwrapped so only their children (text contents)
|
226
230
|
render. Display unsupported elements as literal characters by
|
@@ -278,15 +282,15 @@ class ButtonMixin:
|
|
278
282
|
>>> @st.cache_data
|
279
283
|
... def convert_df(df):
|
280
284
|
... # IMPORTANT: Cache the conversion to prevent computation on every rerun
|
281
|
-
... return df.to_csv().encode(
|
285
|
+
... return df.to_csv().encode("utf-8")
|
282
286
|
>>>
|
283
287
|
>>> csv = convert_df(my_large_df)
|
284
288
|
>>>
|
285
289
|
>>> st.download_button(
|
286
290
|
... label="Download data as CSV",
|
287
291
|
... data=csv,
|
288
|
-
... file_name=
|
289
|
-
... mime=
|
292
|
+
... file_name="large_df.csv",
|
293
|
+
... mime="text/csv",
|
290
294
|
... )
|
291
295
|
|
292
296
|
Download a string as a file:
|
@@ -294,15 +298,15 @@ class ButtonMixin:
|
|
294
298
|
>>> import streamlit as st
|
295
299
|
>>>
|
296
300
|
>>> text_contents = '''This is some text'''
|
297
|
-
>>> st.download_button(
|
301
|
+
>>> st.download_button("Download some text", text_contents)
|
298
302
|
|
299
303
|
Download a binary file:
|
300
304
|
|
301
305
|
>>> import streamlit as st
|
302
306
|
>>>
|
303
|
-
>>> binary_contents = b
|
304
|
-
>>> # Defaults to
|
305
|
-
>>> st.download_button(
|
307
|
+
>>> binary_contents = b"example content"
|
308
|
+
>>> # Defaults to "application/octet-stream"
|
309
|
+
>>> st.download_button("Download binary file", binary_contents)
|
306
310
|
|
307
311
|
Download an image:
|
308
312
|
|
@@ -380,8 +384,10 @@ class ButtonMixin:
|
|
380
384
|
|
381
385
|
* Colored text and background colors for text, using the syntax
|
382
386
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
383
|
-
respectively
|
387
|
+
respectively. ``color`` must be replaced with any of the following
|
384
388
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
389
|
+
For example, you can use ``:orange[your text here]`` or
|
390
|
+
``:blue-background[your text here]``.
|
385
391
|
|
386
392
|
Unsupported elements are unwrapped so only their children (text contents)
|
387
393
|
render. Display unsupported elements as literal characters by
|
@@ -473,8 +479,10 @@ class ButtonMixin:
|
|
473
479
|
|
474
480
|
* Colored text and background colors for text, using the syntax
|
475
481
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
476
|
-
respectively
|
482
|
+
respectively. ``color`` must be replaced with any of the following
|
477
483
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
484
|
+
For example, you can use ``:orange[your text here]`` or
|
485
|
+
``:blue-background[your text here]``.
|
478
486
|
|
479
487
|
Unsupported elements are unwrapped so only their children (text contents)
|
480
488
|
render. Display unsupported elements as literal characters by
|
@@ -114,8 +114,10 @@ class CameraInputMixin:
|
|
114
114
|
|
115
115
|
* Colored text and background colors for text, using the syntax
|
116
116
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
117
|
-
respectively
|
117
|
+
respectively. ``color`` must be replaced with any of the following
|
118
118
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
119
|
+
For example, you can use ``:orange[your text here]`` or
|
120
|
+
``:blue-background[your text here]``.
|
119
121
|
|
120
122
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
121
123
|
Display unsupported elements as literal characters by
|
@@ -140,18 +140,35 @@ class ChatMixin:
|
|
140
140
|
accessibility label. For accessibility reasons, you should not use
|
141
141
|
an empty string.
|
142
142
|
|
143
|
-
avatar :
|
144
|
-
The avatar shown next to the message.
|
143
|
+
avatar : Anything supported by st.image, str, or None
|
144
|
+
The avatar shown next to the message.
|
145
145
|
|
146
|
-
|
146
|
+
If ``avatar`` is ``None`` (default), the icon will be determined
|
147
|
+
from ``name`` as follows:
|
147
148
|
|
148
|
-
*
|
149
|
-
|
150
|
-
(w,h) or (w,h,1) for a monochrome image, (w,h,3) for a color image,
|
151
|
-
or (w,h,4) for an RGBA image.
|
149
|
+
* If ``name`` is ``"user"`` or ``"human"``, the message will have a
|
150
|
+
default user icon.
|
152
151
|
|
153
|
-
If
|
154
|
-
|
152
|
+
* If ``name`` is ``"ai"`` or ``"assistant"``, the message will have
|
153
|
+
a default bot icon.
|
154
|
+
|
155
|
+
* For all other values of ``name``, the message will show the first
|
156
|
+
letter of the name.
|
157
|
+
|
158
|
+
In addition to the types supported by ``st.image`` (like URLs or numpy
|
159
|
+
arrays), the following strings are valid:
|
160
|
+
|
161
|
+
* A single-character emoji. For example, you can set ``avatar="🧑💻"``
|
162
|
+
or ``avatar="🦖"``. Emoji short codes are not supported.
|
163
|
+
|
164
|
+
* An icon from the Material Symbols library (outlined style) in the
|
165
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
166
|
+
of the icon in snake case.
|
167
|
+
|
168
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
169
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
170
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
171
|
+
font library.
|
155
172
|
|
156
173
|
Returns
|
157
174
|
-------
|
@@ -88,8 +88,10 @@ class CheckboxMixin:
|
|
88
88
|
|
89
89
|
* Colored text and background colors for text, using the syntax
|
90
90
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
91
|
-
respectively
|
91
|
+
respectively. ``color`` must be replaced with any of the following
|
92
92
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
93
|
+
For example, you can use ``:orange[your text here]`` or
|
94
|
+
``:blue-background[your text here]``.
|
93
95
|
|
94
96
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
95
97
|
Display unsupported elements as literal characters by
|
@@ -132,10 +134,10 @@ class CheckboxMixin:
|
|
132
134
|
-------
|
133
135
|
>>> import streamlit as st
|
134
136
|
>>>
|
135
|
-
>>> agree = st.checkbox(
|
137
|
+
>>> agree = st.checkbox("I agree")
|
136
138
|
>>>
|
137
139
|
>>> if agree:
|
138
|
-
... st.write(
|
140
|
+
... st.write("Great!")
|
139
141
|
|
140
142
|
.. output::
|
141
143
|
https://doc-checkbox.streamlit.app/
|
@@ -192,8 +194,10 @@ class CheckboxMixin:
|
|
192
194
|
|
193
195
|
* Colored text and background colors for text, using the syntax
|
194
196
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
195
|
-
respectively
|
197
|
+
respectively. ``color`` must be replaced with any of the following
|
196
198
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
199
|
+
For example, you can use ``:orange[your text here]`` or
|
200
|
+
``:blue-background[your text here]``.
|
197
201
|
|
198
202
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
199
203
|
Display unsupported elements as literal characters by
|
@@ -236,10 +240,10 @@ class CheckboxMixin:
|
|
236
240
|
-------
|
237
241
|
>>> import streamlit as st
|
238
242
|
>>>
|
239
|
-
>>> on = st.toggle(
|
243
|
+
>>> on = st.toggle("Activate feature")
|
240
244
|
>>>
|
241
245
|
>>> if on:
|
242
|
-
... st.write(
|
246
|
+
... st.write("Feature activated!")
|
243
247
|
|
244
248
|
.. output::
|
245
249
|
https://doc-toggle.streamlit.app/
|
@@ -88,8 +88,10 @@ class ColorPickerMixin:
|
|
88
88
|
|
89
89
|
* Colored text and background colors for text, using the syntax
|
90
90
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
91
|
-
respectively
|
91
|
+
respectively. ``color`` must be replaced with any of the following
|
92
92
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
93
|
+
For example, you can use ``:orange[your text here]`` or
|
94
|
+
``:blue-background[your text here]``.
|
93
95
|
|
94
96
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
95
97
|
Display unsupported elements as literal characters by
|
@@ -134,8 +136,8 @@ class ColorPickerMixin:
|
|
134
136
|
-------
|
135
137
|
>>> import streamlit as st
|
136
138
|
>>>
|
137
|
-
>>> color = st.color_picker(
|
138
|
-
>>> st.write(
|
139
|
+
>>> color = st.color_picker("Pick A Color", "#00f900")
|
140
|
+
>>> st.write("The current color is", color)
|
139
141
|
|
140
142
|
.. output::
|
141
143
|
https://doc-color-picker.streamlit.app/
|
@@ -243,7 +243,7 @@ class FileUploaderMixin:
|
|
243
243
|
) -> UploadedFile | list[UploadedFile] | None:
|
244
244
|
r"""Display a file uploader widget.
|
245
245
|
By default, uploaded files are limited to 200MB. You can configure
|
246
|
-
this using the
|
246
|
+
this using the ``server.maxUploadSize`` config option. For more info
|
247
247
|
on how to set config options, see
|
248
248
|
https://docs.streamlit.io/library/advanced-features/configuration#set-configuration-options
|
249
249
|
|
@@ -266,8 +266,10 @@ class FileUploaderMixin:
|
|
266
266
|
|
267
267
|
* Colored text and background colors for text, using the syntax
|
268
268
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
269
|
-
respectively
|
269
|
+
respectively. ``color`` must be replaced with any of the following
|
270
270
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
271
|
+
For example, you can use ``:orange[your text here]`` or
|
272
|
+
``:blue-background[your text here]``.
|
271
273
|
|
272
274
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
273
275
|
Display unsupported elements as literal characters by
|
@@ -181,8 +181,10 @@ class MultiSelectMixin:
|
|
181
181
|
|
182
182
|
* Colored text and background colors for text, using the syntax
|
183
183
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
184
|
-
respectively
|
184
|
+
respectively. ``color`` must be replaced with any of the following
|
185
185
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
186
|
+
For example, you can use ``:orange[your text here]`` or
|
187
|
+
``:blue-background[your text here]``.
|
186
188
|
|
187
189
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
188
190
|
Display unsupported elements as literal characters by
|
@@ -240,11 +242,11 @@ class MultiSelectMixin:
|
|
240
242
|
>>> import streamlit as st
|
241
243
|
>>>
|
242
244
|
>>> options = st.multiselect(
|
243
|
-
...
|
244
|
-
... [
|
245
|
-
... [
|
245
|
+
... "What are your favorite colors",
|
246
|
+
... ["Green", "Yellow", "Red", "Blue"],
|
247
|
+
... ["Yellow", "Red"])
|
246
248
|
>>>
|
247
|
-
>>> st.write(
|
249
|
+
>>> st.write("You selected:", options)
|
248
250
|
|
249
251
|
.. output::
|
250
252
|
https://doc-multiselect.streamlit.app/
|
@@ -158,8 +158,10 @@ class NumberInputMixin:
|
|
158
158
|
|
159
159
|
* Colored text and background colors for text, using the syntax
|
160
160
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
161
|
-
respectively
|
161
|
+
respectively. ``color`` must be replaced with any of the following
|
162
162
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
163
|
+
For example, you can use ``:orange[your text here]`` or
|
164
|
+
``:blue-background[your text here]``.
|
163
165
|
|
164
166
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
165
167
|
Display unsupported elements as literal characters by
|
@@ -222,8 +224,8 @@ class NumberInputMixin:
|
|
222
224
|
-------
|
223
225
|
>>> import streamlit as st
|
224
226
|
>>>
|
225
|
-
>>> number = st.number_input(
|
226
|
-
>>> st.write(
|
227
|
+
>>> number = st.number_input("Insert a number")
|
228
|
+
>>> st.write("The current number is ", number)
|
227
229
|
|
228
230
|
.. output::
|
229
231
|
https://doc-number-input.streamlit.app/
|
@@ -234,7 +236,7 @@ class NumberInputMixin:
|
|
234
236
|
>>> import streamlit as st
|
235
237
|
>>>
|
236
238
|
>>> number = st.number_input("Insert a number", value=None, placeholder="Type a number...")
|
237
|
-
>>> st.write(
|
239
|
+
>>> st.write("The current number is ", number)
|
238
240
|
|
239
241
|
.. output::
|
240
242
|
https://doc-number-input-empty.streamlit.app/
|
@@ -121,8 +121,10 @@ class RadioMixin:
|
|
121
121
|
|
122
122
|
* Colored text and background colors for text, using the syntax
|
123
123
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
124
|
-
respectively
|
124
|
+
respectively. ``color`` must be replaced with any of the following
|
125
125
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
126
|
+
For example, you can use ``:orange[your text here]`` or
|
127
|
+
``:blue-background[your text here]``.
|
126
128
|
|
127
129
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
128
130
|
Display unsupported elements as literal characters by
|
@@ -189,10 +191,10 @@ class RadioMixin:
|
|
189
191
|
... [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],
|
190
192
|
... captions = ["Laugh out loud.", "Get the popcorn.", "Never stop learning."])
|
191
193
|
>>>
|
192
|
-
>>> if genre ==
|
193
|
-
... st.write(
|
194
|
+
>>> if genre == ":rainbow[Comedy]":
|
195
|
+
... st.write("You selected comedy.")
|
194
196
|
... else:
|
195
|
-
... st.write("You didn
|
197
|
+
... st.write("You didn't select comedy.")
|
196
198
|
|
197
199
|
.. output::
|
198
200
|
https://doc-radio.streamlit.app/
|
@@ -149,8 +149,10 @@ class SelectSliderMixin:
|
|
149
149
|
|
150
150
|
* Colored text and background colors for text, using the syntax
|
151
151
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
152
|
-
respectively
|
152
|
+
respectively. ``color`` must be replaced with any of the following
|
153
153
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
154
|
+
For example, you can use ``:orange[your text here]`` or
|
155
|
+
``:blue-background[your text here]``.
|
154
156
|
|
155
157
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
156
158
|
Display unsupported elements as literal characters by
|
@@ -207,19 +209,19 @@ class SelectSliderMixin:
|
|
207
209
|
>>> import streamlit as st
|
208
210
|
>>>
|
209
211
|
>>> color = st.select_slider(
|
210
|
-
...
|
211
|
-
... options=[
|
212
|
-
>>> st.write(
|
212
|
+
... "Select a color of the rainbow",
|
213
|
+
... options=["red", "orange", "yellow", "green", "blue", "indigo", "violet"])
|
214
|
+
>>> st.write("My favorite color is", color)
|
213
215
|
|
214
216
|
And here's an example of a range select slider:
|
215
217
|
|
216
218
|
>>> import streamlit as st
|
217
219
|
>>>
|
218
220
|
>>> start_color, end_color = st.select_slider(
|
219
|
-
...
|
220
|
-
... options=[
|
221
|
-
... value=(
|
222
|
-
>>> st.write(
|
221
|
+
... "Select a range of color wavelength",
|
222
|
+
... options=["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
|
223
|
+
... value=("red", "blue"))
|
224
|
+
>>> st.write("You selected wavelengths between", start_color, "and", end_color)
|
223
225
|
|
224
226
|
.. output::
|
225
227
|
https://doc-select-slider.streamlit.app/
|
@@ -113,8 +113,10 @@ class SelectboxMixin:
|
|
113
113
|
|
114
114
|
* Colored text and background colors for text, using the syntax
|
115
115
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
116
|
-
respectively
|
116
|
+
respectively. ``color`` must be replaced with any of the following
|
117
117
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
118
|
+
For example, you can use ``:orange[your text here]`` or
|
119
|
+
``:blue-background[your text here]``.
|
118
120
|
|
119
121
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
120
122
|
Display unsupported elements as literal characters by
|
@@ -150,7 +152,7 @@ class SelectboxMixin:
|
|
150
152
|
An optional dict of kwargs to pass to the callback.
|
151
153
|
placeholder : str
|
152
154
|
A string to display when no options are selected.
|
153
|
-
Defaults to
|
155
|
+
Defaults to "Choose an option".
|
154
156
|
disabled : bool
|
155
157
|
An optional boolean, which disables the selectbox if set to True.
|
156
158
|
The default is False.
|
@@ -170,10 +172,10 @@ class SelectboxMixin:
|
|
170
172
|
>>> import streamlit as st
|
171
173
|
>>>
|
172
174
|
>>> option = st.selectbox(
|
173
|
-
...
|
174
|
-
... (
|
175
|
+
... "How would you like to be contacted?",
|
176
|
+
... ("Email", "Home phone", "Mobile phone"))
|
175
177
|
>>>
|
176
|
-
>>> st.write(
|
178
|
+
>>> st.write("You selected:", option)
|
177
179
|
|
178
180
|
.. output::
|
179
181
|
https://doc-selectbox.streamlit.app/
|
@@ -190,7 +192,7 @@ class SelectboxMixin:
|
|
190
192
|
... placeholder="Select contact method...",
|
191
193
|
... )
|
192
194
|
>>>
|
193
|
-
>>> st.write(
|
195
|
+
>>> st.write("You selected:", option)
|
194
196
|
|
195
197
|
.. output::
|
196
198
|
https://doc-selectbox-empty.streamlit.app/
|
@@ -191,11 +191,11 @@ class SliderMixin:
|
|
191
191
|
This supports int, float, date, time, and datetime types.
|
192
192
|
|
193
193
|
This also allows you to render a range slider by passing a two-element
|
194
|
-
tuple or list as the
|
194
|
+
tuple or list as the ``value``.
|
195
195
|
|
196
|
-
The difference between
|
197
|
-
|
198
|
-
input, while
|
196
|
+
The difference between ``st.slider`` and ``st.select_slider`` is that
|
197
|
+
``slider`` only accepts numerical or date/time data and takes a range as
|
198
|
+
input, while ``select_slider`` accepts any datatype and takes an iterable
|
199
199
|
set of options.
|
200
200
|
|
201
201
|
.. note::
|
@@ -223,8 +223,10 @@ class SliderMixin:
|
|
223
223
|
|
224
224
|
* Colored text and background colors for text, using the syntax
|
225
225
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
226
|
-
respectively
|
226
|
+
respectively. ``color`` must be replaced with any of the following
|
227
227
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
228
|
+
For example, you can use ``:orange[your text here]`` or
|
229
|
+
``:blue-background[your text here]``.
|
228
230
|
|
229
231
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
230
232
|
Display unsupported elements as literal characters by
|
@@ -291,17 +293,17 @@ class SliderMixin:
|
|
291
293
|
--------
|
292
294
|
>>> import streamlit as st
|
293
295
|
>>>
|
294
|
-
>>> age = st.slider(
|
295
|
-
>>> st.write("I'm ", age,
|
296
|
+
>>> age = st.slider("How old are you?", 0, 130, 25)
|
297
|
+
>>> st.write("I'm ", age, "years old")
|
296
298
|
|
297
299
|
And here's an example of a range slider:
|
298
300
|
|
299
301
|
>>> import streamlit as st
|
300
302
|
>>>
|
301
303
|
>>> values = st.slider(
|
302
|
-
...
|
304
|
+
... "Select a range of values",
|
303
305
|
... 0.0, 100.0, (25.0, 75.0))
|
304
|
-
>>> st.write(
|
306
|
+
>>> st.write("Values:", values)
|
305
307
|
|
306
308
|
This is a range time slider:
|
307
309
|
|
@@ -152,8 +152,10 @@ class TextWidgetsMixin:
|
|
152
152
|
|
153
153
|
* Colored text and background colors for text, using the syntax
|
154
154
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
155
|
-
respectively
|
155
|
+
respectively. ``color`` must be replaced with any of the following
|
156
156
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
157
|
+
For example, you can use ``:orange[your text here]`` or
|
158
|
+
``:blue-background[your text here]``.
|
157
159
|
|
158
160
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
159
161
|
Display unsupported elements as literal characters by
|
@@ -212,8 +214,8 @@ class TextWidgetsMixin:
|
|
212
214
|
-------
|
213
215
|
>>> import streamlit as st
|
214
216
|
>>>
|
215
|
-
>>> title = st.text_input(
|
216
|
-
>>> st.write(
|
217
|
+
>>> title = st.text_input("Movie title", "Life of Brian")
|
218
|
+
>>> st.write("The current movie title is", title)
|
217
219
|
|
218
220
|
.. output::
|
219
221
|
https://doc-text-input.streamlit.app/
|
@@ -418,8 +420,10 @@ class TextWidgetsMixin:
|
|
418
420
|
|
419
421
|
* Colored text and background colors for text, using the syntax
|
420
422
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
421
|
-
respectively
|
423
|
+
respectively. ``color`` must be replaced with any of the following
|
422
424
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
425
|
+
For example, you can use ``:orange[your text here]`` or
|
426
|
+
``:blue-background[your text here]``.
|
423
427
|
|
424
428
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
425
429
|
Display unsupported elements as literal characters by
|
@@ -481,7 +485,7 @@ class TextWidgetsMixin:
|
|
481
485
|
... "despair, (...)",
|
482
486
|
... )
|
483
487
|
>>>
|
484
|
-
>>> st.write(f
|
488
|
+
>>> st.write(f"You wrote {len(txt)} characters.")
|
485
489
|
|
486
490
|
.. output::
|
487
491
|
https://doc-text-area.streamlit.app/
|