streamlit-nightly 1.36.1.dev20240720__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.
Files changed (40) hide show
  1. streamlit/commands/execution_control.py +17 -12
  2. streamlit/config.py +8 -4
  3. streamlit/elements/alert.py +6 -6
  4. streamlit/elements/dialog_decorator.py +1 -0
  5. streamlit/elements/heading.py +29 -52
  6. streamlit/elements/layouts.py +44 -83
  7. streamlit/elements/markdown.py +12 -17
  8. streamlit/elements/metric.py +19 -24
  9. streamlit/elements/progress.py +10 -20
  10. streamlit/elements/toast.py +6 -16
  11. streamlit/elements/vega_charts.py +49 -12
  12. streamlit/elements/widgets/button.py +74 -81
  13. streamlit/elements/widgets/button_group.py +50 -22
  14. streamlit/elements/widgets/camera_input.py +12 -21
  15. streamlit/elements/widgets/checkbox.py +40 -42
  16. streamlit/elements/widgets/color_picker.py +20 -21
  17. streamlit/elements/widgets/file_uploader.py +13 -21
  18. streamlit/elements/widgets/multiselect.py +24 -22
  19. streamlit/elements/widgets/number_input.py +31 -25
  20. streamlit/elements/widgets/radio.py +24 -21
  21. streamlit/elements/widgets/select_slider.py +22 -21
  22. streamlit/elements/widgets/selectbox.py +23 -21
  23. streamlit/elements/widgets/slider.py +24 -21
  24. streamlit/elements/widgets/text_widgets.py +48 -43
  25. streamlit/elements/widgets/time_widgets.py +44 -42
  26. streamlit/runtime/context.py +55 -7
  27. streamlit/runtime/fragment.py +3 -4
  28. streamlit/static/asset-manifest.json +3 -3
  29. streamlit/static/index.html +1 -1
  30. streamlit/static/static/js/7175.2779947a.chunk.js +1 -0
  31. streamlit/static/static/js/{main.d55f6a3c.js → main.35bc5645.js} +2 -2
  32. streamlit/testing/v1/app_test.py +10 -0
  33. {streamlit_nightly-1.36.1.dev20240720.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/METADATA +1 -1
  34. {streamlit_nightly-1.36.1.dev20240720.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/RECORD +39 -39
  35. {streamlit_nightly-1.36.1.dev20240720.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/WHEEL +1 -1
  36. streamlit/static/static/js/7175.4cdaec13.chunk.js +0 -1
  37. /streamlit/static/static/js/{main.d55f6a3c.js.LICENSE.txt → main.35bc5645.js.LICENSE.txt} +0 -0
  38. {streamlit_nightly-1.36.1.dev20240720.data → streamlit_nightly-1.36.1.dev20240722.data}/scripts/streamlit.cmd +0 -0
  39. {streamlit_nightly-1.36.1.dev20240720.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/entry_points.txt +0 -0
  40. {streamlit_nightly-1.36.1.dev20240720.dist-info → streamlit_nightly-1.36.1.dev20240722.dist-info}/top_level.txt +0 -0
@@ -54,25 +54,14 @@ class ToastMixin:
54
54
  Parameters
55
55
  ----------
56
56
  body : str
57
- The string to display as Github-flavored Markdown. Syntax
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
- This also supports:
60
+ See the ``body`` parameter of |st.markdown|_ for additional,
61
+ supported Markdown directives.
61
62
 
62
- * Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
63
- For a list of all supported codes,
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), uses
844
- Vega's default. If ``True``, stacks the areas on top of one another.
845
- If ``False``, overlays the areas without stacking. If "normalize",
846
- the areas are stacked and normalized to 100%. If "center", the areas
847
- are stacked and shifted to center their baseline (produces steamgraph).
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
- Finally, if your dataframe is in wide format, you can group multiple
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), uses Vega's
1070
- default. If ``True``, the bars are stacked on top of each other.
1071
- If ``False``, the bars are displayed side by side. If "normalize",
1072
- the bars are stacked and normalized to 100%. If "center", the bars are
1073
- stacked around a central axis. If "layered", the bars are stacked on top
1074
- of one another.
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 and supports the following
99
- elements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.
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
- This also supports:
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
- * Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
104
- For a list of all supported codes,
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
- * LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
108
- must be on their own lines). Supported LaTeX functions are listed
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 and supports the following
231
- elements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.
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
- This also supports:
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
- * Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
236
- For a list of all supported codes,
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
- * LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
240
- must be on their own lines). Supported LaTeX functions are listed
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 and supports the following
398
- elements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.
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
- * Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
403
- For a list of all supported codes,
404
- see https://share.streamlit.io/streamlit/emoji-shortcodes.
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
- * LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
407
- must be on their own lines). Supported LaTeX functions are listed
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
- * Colored text and background colors for text, using the syntax
411
- ``:color[text to be colored]`` and ``:color-background[text to be colored]``,
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
- Labels can optionally contain Markdown and supports the following
498
- elements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.
499
-
500
- This also supports:
501
-
502
- * Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
503
- For a list of all supported codes,
504
- see https://share.streamlit.io/streamlit/emoji-shortcodes.
505
-
506
- * LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
507
- must be on their own lines). Supported LaTeX functions are listed
508
- at https://katex.org/docs/supported.html.
509
-
510
- * Colored text and background colors for text, using the syntax
511
- ``:color[text to be colored]`` and ``:color-background[text to be colored]``,
512
- respectively. ``color`` must be replaced with any of the following
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
- This is useful to collect user feedback, especially in chat-based apps.
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. The options are:
190
- - "thumbs" (default): displays a row of thumbs-up and thumbs-down buttons.
191
- - "faces": displays a row of five buttons with facial expressions, each
192
- depicting increasing satisfaction from left to right.
193
- - "stars": displays a row of star icons typically used for ratings.
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 multiselect widget if set
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 multiselect's value changes.
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
- An integer indicating the user's selection, where 0 is the lowest
213
- feedback and higher values indicate more positive feedback.
214
- If no option was selected, returns None.
215
- - For "thumbs": a return value of 0 is for thumbs-down and 1 for thumbs-up.
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
- Example 1: Display a feedback widget with stars and show the selected sentiment
237
+ Display a feedback widget with stars, and show the selected sentiment:
223
238
 
224
239
  >>> import streamlit as st
225
- >>> sentiment_mapping: = [0.0, 0.25, 0.5, 0.75, 1.0]
240
+ >>>
241
+ >>> sentiment_mapping = ["one", "two", "three", "four", "five"]
226
242
  >>> selected = st.feedback("stars")
227
- >>> st.write(f"You selected: {sentiment_mapping[selected]}")
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
- Example 2: Display a feedback widget with thumbs and show the selected sentiment
250
+ Display a feedback widget with thumbs, and show the selected sentiment:
230
251
 
231
252
  >>> import streamlit as st
232
- >>> sentiment_mapping: = [0.0, 1.0]
253
+ >>>
254
+ >>> sentiment_mapping = [":material/thumb_down:", ":material/thumb_up:"]
233
255
  >>> selected = st.feedback("thumbs")
234
- >>> st.write(f"You selected: {sentiment_mapping[selected]}")
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 and supports the following
106
- elements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.
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
- This also supports:
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
- * Emoji shortcodes, such as ``:+1:`` and ``:sunglasses:``.
111
- For a list of all supported codes,
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