streamlit-nightly 1.36.1.dev20240721__py2.py3-none-any.whl → 1.36.1.dev20240722__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/execution_control.py +17 -12
- streamlit/config.py +8 -4
- streamlit/elements/alert.py +6 -6
- streamlit/elements/dialog_decorator.py +1 -0
- streamlit/elements/heading.py +29 -52
- streamlit/elements/layouts.py +44 -83
- streamlit/elements/markdown.py +12 -17
- streamlit/elements/metric.py +19 -24
- streamlit/elements/progress.py +10 -20
- streamlit/elements/toast.py +6 -16
- streamlit/elements/vega_charts.py +49 -12
- streamlit/elements/widgets/button.py +74 -81
- streamlit/elements/widgets/button_group.py +50 -22
- streamlit/elements/widgets/camera_input.py +12 -21
- streamlit/elements/widgets/checkbox.py +40 -42
- streamlit/elements/widgets/color_picker.py +20 -21
- streamlit/elements/widgets/file_uploader.py +13 -21
- streamlit/elements/widgets/multiselect.py +24 -22
- streamlit/elements/widgets/number_input.py +31 -25
- streamlit/elements/widgets/radio.py +24 -21
- streamlit/elements/widgets/select_slider.py +22 -21
- streamlit/elements/widgets/selectbox.py +23 -21
- streamlit/elements/widgets/slider.py +24 -21
- streamlit/elements/widgets/text_widgets.py +48 -43
- streamlit/elements/widgets/time_widgets.py +44 -42
- streamlit/runtime/context.py +55 -7
- streamlit/runtime/fragment.py +3 -4
- streamlit/static/asset-manifest.json +3 -3
- streamlit/static/index.html +1 -1
- streamlit/static/static/js/7175.2779947a.chunk.js +1 -0
- streamlit/static/static/js/{main.d55f6a3c.js → main.35bc5645.js} +2 -2
- streamlit/testing/v1/app_test.py +10 -0
- {streamlit_nightly-1.36.1.dev20240721.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.36.1.dev20240721.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/RECORD +39 -39
- streamlit/static/static/js/7175.4cdaec13.chunk.js +0 -1
- /streamlit/static/static/js/{main.d55f6a3c.js.LICENSE.txt → main.35bc5645.js.LICENSE.txt} +0 -0
- {streamlit_nightly-1.36.1.dev20240721.data → streamlit_nightly-1.36.1.dev20240722.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.36.1.dev20240721.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.36.1.dev20240721.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.36.1.dev20240721.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/top_level.txt +0 -0
streamlit/elements/toast.py
CHANGED
@@ -54,25 +54,14 @@ class ToastMixin:
|
|
54
54
|
Parameters
|
55
55
|
----------
|
56
56
|
body : str
|
57
|
-
The string to display as
|
57
|
+
The string to display as GitHub-flavored Markdown. Syntax
|
58
58
|
information can be found at: https://github.github.com/gfm.
|
59
59
|
|
60
|
-
|
60
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
61
|
+
supported Markdown directives.
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
see https://share.streamlit.io/streamlit/emoji-shortcodes.
|
65
|
-
|
66
|
-
* LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
|
67
|
-
must be on their own lines). Supported LaTeX functions are listed
|
68
|
-
at https://katex.org/docs/supported.html.
|
69
|
-
|
70
|
-
* Colored text and background colors for text, using the syntax
|
71
|
-
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
72
|
-
respectively. ``color`` must be replaced with any of the following
|
73
|
-
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
74
|
-
For example, you can use ``:orange[your text here]`` or
|
75
|
-
``:blue-background[your text here]``.
|
63
|
+
.. |st.markdown| replace:: ``st.markdown``
|
64
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
76
65
|
|
77
66
|
icon : str, None
|
78
67
|
An optional emoji or icon to display next to the alert. If ``icon``
|
@@ -91,6 +80,7 @@ class ToastMixin:
|
|
91
80
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
92
81
|
font library.
|
93
82
|
|
83
|
+
|
94
84
|
Example
|
95
85
|
-------
|
96
86
|
>>> import streamlit as st
|
@@ -840,11 +840,16 @@ class VegaChartsMixin:
|
|
840
840
|
for three lines).
|
841
841
|
|
842
842
|
stack : bool, "normalize", "center", or None
|
843
|
-
Whether to stack the areas. If this is ``None`` (default),
|
844
|
-
Vega's default.
|
845
|
-
|
846
|
-
|
847
|
-
|
843
|
+
Whether to stack the areas. If this is ``None`` (default),
|
844
|
+
Streamlit uses Vega's default. Other values can be as follows:
|
845
|
+
|
846
|
+
- ``True``: The areas form a non-overlapping, additive stack within
|
847
|
+
the chart.
|
848
|
+
- ``False``: The areas overlap each other without stacking.
|
849
|
+
- ``"normalize"``: The areas are stacked and the total height is
|
850
|
+
normalized to 100% of the height of the chart.
|
851
|
+
- ``"center"``: The areas are stacked and shifted to center their
|
852
|
+
baseline, which creates a steamgraph.
|
848
853
|
|
849
854
|
width : int or None
|
850
855
|
Desired width of the chart expressed in pixels. If ``width`` is
|
@@ -904,7 +909,7 @@ class VegaChartsMixin:
|
|
904
909
|
https://doc-area-chart1.streamlit.app/
|
905
910
|
height: 440px
|
906
911
|
|
907
|
-
|
912
|
+
If your dataframe is in wide format, you can group multiple
|
908
913
|
columns under the y argument to show multiple series with different
|
909
914
|
colors:
|
910
915
|
|
@@ -927,6 +932,20 @@ class VegaChartsMixin:
|
|
927
932
|
https://doc-area-chart2.streamlit.app/
|
928
933
|
height: 440px
|
929
934
|
|
935
|
+
You can adjust the stacking behavior by setting ``stack``. Create a
|
936
|
+
steamgraph:
|
937
|
+
|
938
|
+
>>> import streamlit as st
|
939
|
+
>>> from vega_datasets import data
|
940
|
+
>>>
|
941
|
+
>>> source = data.unemployment_across_industries()
|
942
|
+
>>>
|
943
|
+
>>> st.area_chart(source, x="date", y="count", color="series", stack="center")
|
944
|
+
|
945
|
+
.. output::
|
946
|
+
https://doc-area-chart-steamgraph.streamlit.app/
|
947
|
+
height: 440px
|
948
|
+
|
930
949
|
"""
|
931
950
|
|
932
951
|
# Check that the stack parameter is valid, raise more informative error message if not
|
@@ -1066,12 +1085,17 @@ class VegaChartsMixin:
|
|
1066
1085
|
horizontally.
|
1067
1086
|
|
1068
1087
|
stack : bool, "normalize", "center", "layered", or None
|
1069
|
-
Whether to stack the bars. If this is ``None`` (default),
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1088
|
+
Whether to stack the bars. If this is ``None`` (default),
|
1089
|
+
Streamlit uses Vega's default. Other values can be as follows:
|
1090
|
+
|
1091
|
+
- ``True``: The bars form a non-overlapping, additive stack within
|
1092
|
+
the chart.
|
1093
|
+
- ``False``: The bars display side by side.
|
1094
|
+
- ``"layered"``: The bars overlap each other without stacking.
|
1095
|
+
- ``"normalize"``: The bars are stacked and the total height is
|
1096
|
+
normalized to 100% of the height of the chart.
|
1097
|
+
- ``"center"``: The bars are stacked and shifted to center the
|
1098
|
+
total height around an axis.
|
1075
1099
|
|
1076
1100
|
width : int or None
|
1077
1101
|
Desired width of the chart expressed in pixels. If ``width`` is
|
@@ -1171,6 +1195,19 @@ class VegaChartsMixin:
|
|
1171
1195
|
https://doc-bar-chart-horizontal.streamlit.app/
|
1172
1196
|
height: 440px
|
1173
1197
|
|
1198
|
+
You can unstack your bar charts.
|
1199
|
+
|
1200
|
+
>>> import streamlit as st
|
1201
|
+
>>> from vega_datasets import data
|
1202
|
+
>>>
|
1203
|
+
>>> source = data.barley()
|
1204
|
+
>>>
|
1205
|
+
>>> st.bar_chart(source, x="year", y="yield", color="site", stack=False)
|
1206
|
+
|
1207
|
+
.. output::
|
1208
|
+
https://doc-bar-chart-unstacked.streamlit.app/
|
1209
|
+
height: 440px
|
1210
|
+
|
1174
1211
|
"""
|
1175
1212
|
|
1176
1213
|
# Check that the stack parameter is valid, raise more informative error message if not
|
@@ -95,50 +95,49 @@ class ButtonMixin:
|
|
95
95
|
----------
|
96
96
|
label : str
|
97
97
|
A short label explaining to the user what this button is for.
|
98
|
-
The label can optionally contain Markdown
|
99
|
-
|
98
|
+
The label can optionally contain GitHub-flavored Markdown of the
|
99
|
+
following types: Bold, Italics, Strikethroughs, Inline Code, and
|
100
|
+
Links.
|
100
101
|
|
101
|
-
|
102
|
+
Unsupported Markdown elements are unwrapped so only their children
|
103
|
+
(text contents) render. Display unsupported elements as literal
|
104
|
+
characters by backslash-escaping them. E.g.,
|
105
|
+
``"1\. Not an ordered list"``.
|
102
106
|
|
103
|
-
|
104
|
-
|
105
|
-
see https://share.streamlit.io/streamlit/emoji-shortcodes.
|
107
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
108
|
+
supported Markdown directives.
|
106
109
|
|
107
|
-
|
108
|
-
|
109
|
-
at https://katex.org/docs/supported.html.
|
110
|
+
.. |st.markdown| replace:: ``st.markdown``
|
111
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
110
112
|
|
111
|
-
* Colored text and background colors for text, using the syntax
|
112
|
-
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
113
|
-
respectively. ``color`` must be replaced with any of the following
|
114
|
-
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
115
|
-
For example, you can use ``:orange[your text here]`` or
|
116
|
-
``:blue-background[your text here]``.
|
117
|
-
|
118
|
-
Unsupported elements are unwrapped so only their children (text contents) render.
|
119
|
-
Display unsupported elements as literal characters by
|
120
|
-
backslash-escaping them. E.g. ``1\. Not an ordered list``.
|
121
113
|
key : str or int
|
122
114
|
An optional string or integer to use as the unique key for the widget.
|
123
115
|
If this is omitted, a key will be generated for the widget
|
124
116
|
based on its content. Multiple widgets of the same type may
|
125
117
|
not share the same key.
|
118
|
+
|
126
119
|
help : str
|
127
120
|
An optional tooltip that gets displayed when the button is
|
128
121
|
hovered over.
|
122
|
+
|
129
123
|
on_click : callable
|
130
124
|
An optional callback invoked when this button is clicked.
|
125
|
+
|
131
126
|
args : tuple
|
132
127
|
An optional tuple of args to pass to the callback.
|
128
|
+
|
133
129
|
kwargs : dict
|
134
130
|
An optional dict of kwargs to pass to the callback.
|
131
|
+
|
135
132
|
type : "secondary" or "primary"
|
136
133
|
An optional string that specifies the button type. Can be "primary" for a
|
137
134
|
button with additional emphasis or "secondary" for a normal button. Defaults
|
138
135
|
to "secondary".
|
136
|
+
|
139
137
|
disabled : bool
|
140
138
|
An optional boolean, which disables the button if set to True. The
|
141
139
|
default is False.
|
140
|
+
|
142
141
|
use_container_width : bool
|
143
142
|
Whether to expand the button's width to fill its parent container.
|
144
143
|
If ``use_container_width`` is ``False`` (default), Streamlit sizes
|
@@ -227,62 +226,64 @@ class ButtonMixin:
|
|
227
226
|
----------
|
228
227
|
label : str
|
229
228
|
A short label explaining to the user what this button is for.
|
230
|
-
The label can optionally contain Markdown
|
231
|
-
|
229
|
+
The label can optionally contain GitHub-flavored Markdown of the
|
230
|
+
following types: Bold, Italics, Strikethroughs, Inline Code, and
|
231
|
+
Links.
|
232
232
|
|
233
|
-
|
233
|
+
Unsupported Markdown elements are unwrapped so only their children
|
234
|
+
(text contents) render. Display unsupported elements as literal
|
235
|
+
characters by backslash-escaping them. E.g.,
|
236
|
+
``"1\. Not an ordered list"``.
|
234
237
|
|
235
|
-
|
236
|
-
|
237
|
-
see https://share.streamlit.io/streamlit/emoji-shortcodes.
|
238
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
239
|
+
supported Markdown directives.
|
238
240
|
|
239
|
-
|
240
|
-
|
241
|
-
at https://katex.org/docs/supported.html.
|
241
|
+
.. |st.markdown| replace:: ``st.markdown``
|
242
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
242
243
|
|
243
|
-
* Colored text and background colors for text, using the syntax
|
244
|
-
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
245
|
-
respectively. ``color`` must be replaced with any of the following
|
246
|
-
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
247
|
-
For example, you can use ``:orange[your text here]`` or
|
248
|
-
``:blue-background[your text here]``.
|
249
|
-
|
250
|
-
Unsupported elements are unwrapped so only their children (text contents)
|
251
|
-
render. Display unsupported elements as literal characters by
|
252
|
-
backslash-escaping them. E.g. ``1\. Not an ordered list``.
|
253
244
|
data : str or bytes or file
|
254
245
|
The contents of the file to be downloaded. See example below for
|
255
246
|
caching techniques to avoid recomputing this data unnecessarily.
|
247
|
+
|
256
248
|
file_name: str
|
257
249
|
An optional string to use as the name of the file to be downloaded,
|
258
250
|
such as 'my_file.csv'. If not specified, the name will be
|
259
251
|
automatically generated.
|
252
|
+
|
260
253
|
mime : str or None
|
261
254
|
The MIME type of the data. If None, defaults to "text/plain"
|
262
255
|
(if data is of type *str* or is a textual *file*) or
|
263
256
|
"application/octet-stream" (if data is of type *bytes* or is a
|
264
257
|
binary *file*).
|
258
|
+
|
265
259
|
key : str or int
|
266
260
|
An optional string or integer to use as the unique key for the widget.
|
267
261
|
If this is omitted, a key will be generated for the widget
|
268
262
|
based on its content. Multiple widgets of the same type may
|
269
263
|
not share the same key.
|
264
|
+
|
270
265
|
help : str
|
271
266
|
An optional tooltip that gets displayed when the button is
|
272
267
|
hovered over.
|
268
|
+
|
273
269
|
on_click : callable
|
274
270
|
An optional callback invoked when this button is clicked.
|
271
|
+
|
275
272
|
args : tuple
|
276
273
|
An optional tuple of args to pass to the callback.
|
274
|
+
|
277
275
|
kwargs : dict
|
278
276
|
An optional dict of kwargs to pass to the callback.
|
277
|
+
|
279
278
|
type : "secondary" or "primary"
|
280
279
|
An optional string that specifies the button type. Can be "primary" for a
|
281
280
|
button with additional emphasis or "secondary" for a normal button. Defaults
|
282
281
|
to "secondary".
|
282
|
+
|
283
283
|
disabled : bool
|
284
284
|
An optional boolean, which disables the download button if set to
|
285
285
|
True. The default is False.
|
286
|
+
|
286
287
|
use_container_width : bool
|
287
288
|
Whether to expand the button's width to fill its parent container.
|
288
289
|
If ``use_container_width`` is ``False`` (default), Streamlit sizes
|
@@ -394,41 +395,37 @@ class ButtonMixin:
|
|
394
395
|
----------
|
395
396
|
label : str
|
396
397
|
A short label explaining to the user what this button is for.
|
397
|
-
The label can optionally contain Markdown
|
398
|
-
|
399
|
-
|
400
|
-
This also supports:
|
398
|
+
The label can optionally contain GitHub-flavored Markdown of the
|
399
|
+
following types: Bold, Italics, Strikethroughs, Inline Code, and
|
400
|
+
Links.
|
401
401
|
|
402
|
-
|
403
|
-
|
404
|
-
|
402
|
+
Unsupported Markdown elements are unwrapped so only their children
|
403
|
+
(text contents) render. Display unsupported elements as literal
|
404
|
+
characters by backslash-escaping them. E.g.,
|
405
|
+
``"1\. Not an ordered list"``.
|
405
406
|
|
406
|
-
|
407
|
-
|
408
|
-
at https://katex.org/docs/supported.html.
|
407
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
408
|
+
supported Markdown directives.
|
409
409
|
|
410
|
-
|
411
|
-
|
412
|
-
respectively. ``color`` must be replaced with any of the following
|
413
|
-
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
414
|
-
For example, you can use ``:orange[your text here]`` or
|
415
|
-
``:blue-background[your text here]``.
|
410
|
+
.. |st.markdown| replace:: ``st.markdown``
|
411
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
416
412
|
|
417
|
-
Unsupported elements are unwrapped so only their children (text contents)
|
418
|
-
render. Display unsupported elements as literal characters by
|
419
|
-
backslash-escaping them. E.g. ``1\. Not an ordered list``.
|
420
413
|
url : str
|
421
414
|
The url to be opened on user click
|
415
|
+
|
422
416
|
help : str
|
423
417
|
An optional tooltip that gets displayed when the button is
|
424
418
|
hovered over.
|
419
|
+
|
425
420
|
type : "secondary" or "primary"
|
426
421
|
An optional string that specifies the button type. Can be "primary" for a
|
427
422
|
button with additional emphasis or "secondary" for a normal button. Defaults
|
428
423
|
to "secondary".
|
424
|
+
|
429
425
|
disabled : bool
|
430
426
|
An optional boolean, which disables the link button if set to
|
431
427
|
True. The default is False.
|
428
|
+
|
432
429
|
use_container_width : bool
|
433
430
|
Whether to expand the button's width to fill its parent container.
|
434
431
|
If ``use_container_width`` is ``False`` (default), Streamlit sizes
|
@@ -492,32 +489,25 @@ class ButtonMixin:
|
|
492
489
|
The file path (relative to the main script) or an st.Page indicating
|
493
490
|
the page to switch to. Alternatively, this can be the URL to an
|
494
491
|
external page (must start with "http://" or "https://").
|
492
|
+
|
495
493
|
label : str
|
496
494
|
The label for the page link. Labels are required for external pages.
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
514
|
-
For example, you can use ``:orange[your text here]`` or
|
515
|
-
``:blue-background[your text here]``.
|
516
|
-
|
517
|
-
Unsupported elements are unwrapped so only their children (text contents)
|
518
|
-
render. Display unsupported elements as literal characters by
|
519
|
-
backslash-escaping them. E.g. ``1\. Not an ordered list``.
|
520
|
-
icon : str, None
|
495
|
+
The label can optionally contain GitHub-flavored Markdown of the
|
496
|
+
following types: Bold, Italics, Strikethroughs, Inline Code, and
|
497
|
+
Links.
|
498
|
+
|
499
|
+
Unsupported Markdown elements are unwrapped so only their children
|
500
|
+
(text contents) render. Display unsupported elements as literal
|
501
|
+
characters by backslash-escaping them. E.g.,
|
502
|
+
``"1\. Not an ordered list"``.
|
503
|
+
|
504
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
505
|
+
supported Markdown directives.
|
506
|
+
|
507
|
+
.. |st.markdown| replace:: ``st.markdown``
|
508
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
509
|
+
|
510
|
+
icon : str or None
|
521
511
|
An optional emoji or icon to display next to the button label. If ``icon``
|
522
512
|
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
523
513
|
string, the following options are valid:
|
@@ -533,12 +523,15 @@ class ButtonMixin:
|
|
533
523
|
Thumb Up icon. Find additional icons in the `Material Symbols \
|
534
524
|
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Rounded>`_
|
535
525
|
font library.
|
526
|
+
|
536
527
|
help : str
|
537
528
|
An optional tooltip that gets displayed when the link is
|
538
529
|
hovered over.
|
530
|
+
|
539
531
|
disabled : bool
|
540
532
|
An optional boolean, which disables the page link if set to
|
541
533
|
``True``. The default is ``False``.
|
534
|
+
|
542
535
|
use_container_width : bool
|
543
536
|
Whether to expand the link's width to fill its parent container.
|
544
537
|
The default is ``True`` for page links in the sidebar and ``False``
|
@@ -181,57 +181,85 @@ class ButtonGroupMixin:
|
|
181
181
|
) -> int | None:
|
182
182
|
"""Display a feedback widget.
|
183
183
|
|
184
|
-
|
184
|
+
A feedback widget is an icon-based button group available in three
|
185
|
+
styles, as described in ``options``. It is commonly used in chat and AI
|
186
|
+
apps to allow users to rate responses.
|
185
187
|
|
186
|
-
Parameters
|
187
|
-
|
188
|
+
Parameters
|
189
|
+
----------
|
188
190
|
options: "thumbs", "faces", or "stars"
|
189
|
-
The feedback options displayed to the user.
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
191
|
+
The feedback options displayed to the user. ``options`` can be one
|
192
|
+
of the following:
|
193
|
+
|
194
|
+
- ``"thumbs"`` (default): Streamlit displays a thumb-up and
|
195
|
+
thumb-down button group.
|
196
|
+
- ``"faces"``: Streamlit displays a row of five buttons with
|
197
|
+
facial expressions depicting increasing satisfaction from left to
|
198
|
+
right.
|
199
|
+
- ``"stars"``: Streamlit displays a row of star icons, allowing the
|
200
|
+
user to select a rating from one to five stars.
|
201
|
+
|
194
202
|
key : str or int
|
195
203
|
An optional string or integer to use as the unique key for the widget.
|
196
204
|
If this is omitted, a key will be generated for the widget
|
197
205
|
based on its content. Multiple widgets of the same type may
|
198
206
|
not share the same key.
|
207
|
+
|
199
208
|
disabled : bool
|
200
|
-
An optional boolean, which disables the
|
209
|
+
An optional boolean, which disables the feedback widget if set
|
201
210
|
to True. The default is False. This argument can only be supplied
|
202
211
|
by keyword.
|
212
|
+
|
203
213
|
on_change : callable
|
204
|
-
An optional callback invoked when this
|
214
|
+
An optional callback invoked when this feedback widget's value
|
215
|
+
changes.
|
216
|
+
|
205
217
|
args : tuple
|
206
218
|
An optional tuple of args to pass to the callback.
|
219
|
+
|
207
220
|
kwargs : dict
|
208
221
|
An optional dict of kwargs to pass to the callback.
|
209
222
|
|
210
223
|
Returns
|
211
224
|
-------
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
- For "faces" and "stars":
|
217
|
-
values range from 0 (least satisfied) to 4 (most satisfied).
|
225
|
+
int or None
|
226
|
+
An integer indicating the user's selection, where ``0`` is the
|
227
|
+
lowest feedback. Higher values indicate more positive feedback.
|
228
|
+
If no option was selected, the widget returns ``None``.
|
218
229
|
|
230
|
+
- For ``options="thumbs"``, a return value of ``0`` indicates
|
231
|
+
thumbs-down, and ``1`` indicates thumbs-up.
|
232
|
+
- For ``options="faces"`` and ``options="stars"``, return values
|
233
|
+
range from ``0`` (least satisfied) to ``4`` (most satisfied).
|
219
234
|
|
220
235
|
Examples
|
221
236
|
--------
|
222
|
-
|
237
|
+
Display a feedback widget with stars, and show the selected sentiment:
|
223
238
|
|
224
239
|
>>> import streamlit as st
|
225
|
-
>>>
|
240
|
+
>>>
|
241
|
+
>>> sentiment_mapping = ["one", "two", "three", "four", "five"]
|
226
242
|
>>> selected = st.feedback("stars")
|
227
|
-
>>>
|
243
|
+
>>> if selected is not None:
|
244
|
+
>>> st.markdown(f"You selected {sentiment_mapping[selected]} star(s).")
|
245
|
+
|
246
|
+
.. output ::
|
247
|
+
https://doc-feedback-stars.streamlit.app/
|
248
|
+
height: 350px
|
228
249
|
|
229
|
-
|
250
|
+
Display a feedback widget with thumbs, and show the selected sentiment:
|
230
251
|
|
231
252
|
>>> import streamlit as st
|
232
|
-
>>>
|
253
|
+
>>>
|
254
|
+
>>> sentiment_mapping = [":material/thumb_down:", ":material/thumb_up:"]
|
233
255
|
>>> selected = st.feedback("thumbs")
|
234
|
-
>>>
|
256
|
+
>>> if selected is not None:
|
257
|
+
>>> st.markdown(f"You selected: {sentiment_mapping[selected]}")
|
258
|
+
|
259
|
+
.. output ::
|
260
|
+
https://doc-feedback-thumbs.streamlit.app/
|
261
|
+
height: 350px
|
262
|
+
|
235
263
|
"""
|
236
264
|
|
237
265
|
if not isinstance(options, list) and options not in get_args(_FeedbackOptions):
|
@@ -102,34 +102,25 @@ class CameraInputMixin:
|
|
102
102
|
----------
|
103
103
|
label : str
|
104
104
|
A short label explaining to the user what this widget is used for.
|
105
|
-
The label can optionally contain Markdown
|
106
|
-
|
105
|
+
The label can optionally contain GitHub-flavored Markdown of the
|
106
|
+
following types: Bold, Italics, Strikethroughs, Inline Code, and
|
107
|
+
Links.
|
107
108
|
|
108
|
-
|
109
|
+
Unsupported Markdown elements are unwrapped so only their children
|
110
|
+
(text contents) render. Display unsupported elements as literal
|
111
|
+
characters by backslash-escaping them. E.g.,
|
112
|
+
``"1\. Not an ordered list"``.
|
109
113
|
|
110
|
-
|
111
|
-
|
112
|
-
see https://share.streamlit.io/streamlit/emoji-shortcodes.
|
113
|
-
|
114
|
-
* LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
|
115
|
-
must be on their own lines). Supported LaTeX functions are listed
|
116
|
-
at https://katex.org/docs/supported.html.
|
117
|
-
|
118
|
-
* Colored text and background colors for text, using the syntax
|
119
|
-
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
120
|
-
respectively. ``color`` must be replaced with any of the following
|
121
|
-
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
122
|
-
For example, you can use ``:orange[your text here]`` or
|
123
|
-
``:blue-background[your text here]``.
|
124
|
-
|
125
|
-
Unsupported elements are unwrapped so only their children (text contents) render.
|
126
|
-
Display unsupported elements as literal characters by
|
127
|
-
backslash-escaping them. E.g. ``1\. Not an ordered list``.
|
114
|
+
See the ``body`` parameter of |st.markdown|_ for additional,
|
115
|
+
supported Markdown directives.
|
128
116
|
|
129
117
|
For accessibility reasons, you should never set an empty label (label="")
|
130
118
|
but hide it with label_visibility if needed. In the future, we may disallow
|
131
119
|
empty labels by raising an exception.
|
132
120
|
|
121
|
+
.. |st.markdown| replace:: ``st.markdown``
|
122
|
+
.. _st.markdown: https://docs.streamlit.io/develop/api-reference/text/st.markdown
|
123
|
+
|
133
124
|
key : str or int
|
134
125
|
An optional string or integer to use as the unique key for the widget.
|
135
126
|
If this is omitted, a key will be generated for the widget
|