streamlit 1.49.1__py3-none-any.whl → 1.51.0__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 (259) hide show
  1. streamlit/__init__.py +4 -1
  2. streamlit/column_config.py +2 -0
  3. streamlit/commands/navigation.py +7 -7
  4. streamlit/commands/page_config.py +4 -6
  5. streamlit/components/v1/custom_component.py +17 -42
  6. streamlit/components/v2/__init__.py +458 -0
  7. streamlit/components/v2/bidi_component/__init__.py +20 -0
  8. streamlit/components/v2/bidi_component/constants.py +29 -0
  9. streamlit/components/v2/bidi_component/main.py +386 -0
  10. streamlit/components/v2/bidi_component/serialization.py +265 -0
  11. streamlit/components/v2/bidi_component/state.py +92 -0
  12. streamlit/components/v2/component_definition_resolver.py +143 -0
  13. streamlit/components/v2/component_file_watcher.py +403 -0
  14. streamlit/components/v2/component_manager.py +431 -0
  15. streamlit/components/v2/component_manifest_handler.py +122 -0
  16. streamlit/components/v2/component_path_utils.py +245 -0
  17. streamlit/components/v2/component_registry.py +409 -0
  18. streamlit/components/v2/get_bidi_component_manager.py +51 -0
  19. streamlit/components/v2/manifest_scanner.py +615 -0
  20. streamlit/components/v2/presentation.py +198 -0
  21. streamlit/components/v2/types.py +324 -0
  22. streamlit/config.py +741 -32
  23. streamlit/config_option.py +4 -1
  24. streamlit/config_util.py +650 -1
  25. streamlit/connections/base_connection.py +4 -2
  26. streamlit/dataframe_util.py +18 -10
  27. streamlit/delta_generator.py +8 -7
  28. streamlit/delta_generator_singletons.py +3 -1
  29. streamlit/deprecation_util.py +17 -6
  30. streamlit/elements/arrow.py +90 -42
  31. streamlit/elements/deck_gl_json_chart.py +98 -39
  32. streamlit/elements/dialog_decorator.py +2 -1
  33. streamlit/elements/exception.py +3 -1
  34. streamlit/elements/form.py +6 -6
  35. streamlit/elements/graphviz_chart.py +24 -9
  36. streamlit/elements/heading.py +3 -5
  37. streamlit/elements/iframe.py +0 -2
  38. streamlit/elements/image.py +12 -13
  39. streamlit/elements/layouts.py +89 -22
  40. streamlit/elements/lib/built_in_chart_utils.py +95 -31
  41. streamlit/elements/lib/color_util.py +8 -18
  42. streamlit/elements/lib/column_config_utils.py +9 -8
  43. streamlit/elements/lib/column_types.py +595 -148
  44. streamlit/elements/lib/dialog.py +3 -2
  45. streamlit/elements/lib/image_utils.py +3 -5
  46. streamlit/elements/lib/layout_utils.py +50 -13
  47. streamlit/elements/lib/mutable_status_container.py +2 -2
  48. streamlit/elements/lib/options_selector_utils.py +2 -2
  49. streamlit/elements/lib/pandas_styler_utils.py +30 -14
  50. streamlit/elements/lib/utils.py +21 -9
  51. streamlit/elements/map.py +81 -40
  52. streamlit/elements/media.py +7 -7
  53. streamlit/elements/metric.py +11 -35
  54. streamlit/elements/pdf.py +2 -4
  55. streamlit/elements/plotly_chart.py +142 -26
  56. streamlit/elements/progress.py +2 -4
  57. streamlit/elements/pyplot.py +6 -6
  58. streamlit/elements/space.py +113 -0
  59. streamlit/elements/vega_charts.py +400 -143
  60. streamlit/elements/widgets/audio_input.py +52 -4
  61. streamlit/elements/widgets/button.py +29 -29
  62. streamlit/elements/widgets/button_group.py +33 -6
  63. streamlit/elements/widgets/camera_input.py +3 -4
  64. streamlit/elements/widgets/chat.py +7 -0
  65. streamlit/elements/widgets/checkbox.py +1 -0
  66. streamlit/elements/widgets/color_picker.py +1 -0
  67. streamlit/elements/widgets/data_editor.py +34 -29
  68. streamlit/elements/widgets/file_uploader.py +6 -10
  69. streamlit/elements/widgets/multiselect.py +14 -3
  70. streamlit/elements/widgets/number_input.py +5 -4
  71. streamlit/elements/widgets/radio.py +10 -2
  72. streamlit/elements/widgets/select_slider.py +8 -4
  73. streamlit/elements/widgets/selectbox.py +9 -2
  74. streamlit/elements/widgets/slider.py +38 -41
  75. streamlit/elements/widgets/text_widgets.py +6 -0
  76. streamlit/elements/widgets/time_widgets.py +15 -12
  77. streamlit/elements/write.py +28 -23
  78. streamlit/emojis.py +1 -1
  79. streamlit/errors.py +115 -0
  80. streamlit/git_util.py +65 -43
  81. streamlit/hello/hello.py +8 -0
  82. streamlit/hello/utils.py +2 -1
  83. streamlit/material_icon_names.py +1 -1
  84. streamlit/navigation/page.py +4 -1
  85. streamlit/proto/ArrowData_pb2.py +27 -0
  86. streamlit/proto/ArrowData_pb2.pyi +46 -0
  87. streamlit/proto/Arrow_pb2.py +10 -8
  88. streamlit/proto/Arrow_pb2.pyi +31 -2
  89. streamlit/proto/AudioInput_pb2.py +2 -2
  90. streamlit/proto/AudioInput_pb2.pyi +6 -2
  91. streamlit/proto/BidiComponent_pb2.py +34 -0
  92. streamlit/proto/BidiComponent_pb2.pyi +153 -0
  93. streamlit/proto/Block_pb2.py +11 -11
  94. streamlit/proto/Block_pb2.pyi +9 -1
  95. streamlit/proto/DeckGlJsonChart_pb2.py +10 -4
  96. streamlit/proto/DeckGlJsonChart_pb2.pyi +9 -3
  97. streamlit/proto/Element_pb2.py +5 -3
  98. streamlit/proto/Element_pb2.pyi +14 -4
  99. streamlit/proto/HeightConfig_pb2.py +2 -2
  100. streamlit/proto/HeightConfig_pb2.pyi +6 -3
  101. streamlit/proto/NewSession_pb2.py +18 -16
  102. streamlit/proto/NewSession_pb2.pyi +158 -6
  103. streamlit/proto/PlotlyChart_pb2.py +8 -6
  104. streamlit/proto/PlotlyChart_pb2.pyi +3 -1
  105. streamlit/proto/Space_pb2.py +27 -0
  106. streamlit/proto/Space_pb2.pyi +42 -0
  107. streamlit/proto/WidgetStates_pb2.py +2 -2
  108. streamlit/proto/WidgetStates_pb2.pyi +13 -3
  109. streamlit/proto/WidthConfig_pb2.py +2 -2
  110. streamlit/proto/WidthConfig_pb2.pyi +6 -3
  111. streamlit/runtime/app_session.py +45 -6
  112. streamlit/runtime/caching/cache_data_api.py +4 -4
  113. streamlit/runtime/caching/cache_errors.py +4 -1
  114. streamlit/runtime/caching/cache_resource_api.py +3 -2
  115. streamlit/runtime/caching/cache_utils.py +2 -1
  116. streamlit/runtime/caching/cached_message_replay.py +3 -3
  117. streamlit/runtime/caching/hashing.py +3 -4
  118. streamlit/runtime/caching/legacy_cache_api.py +2 -1
  119. streamlit/runtime/connection_factory.py +1 -3
  120. streamlit/runtime/forward_msg_queue.py +4 -1
  121. streamlit/runtime/fragment.py +2 -1
  122. streamlit/runtime/memory_media_file_storage.py +1 -1
  123. streamlit/runtime/metrics_util.py +6 -2
  124. streamlit/runtime/runtime.py +14 -0
  125. streamlit/runtime/scriptrunner/exec_code.py +2 -1
  126. streamlit/runtime/scriptrunner/script_runner.py +2 -2
  127. streamlit/runtime/scriptrunner_utils/script_run_context.py +3 -6
  128. streamlit/runtime/secrets.py +2 -4
  129. streamlit/runtime/session_manager.py +3 -1
  130. streamlit/runtime/state/common.py +30 -5
  131. streamlit/runtime/state/presentation.py +85 -0
  132. streamlit/runtime/state/safe_session_state.py +2 -2
  133. streamlit/runtime/state/session_state.py +220 -16
  134. streamlit/runtime/state/widgets.py +19 -3
  135. streamlit/runtime/theme_util.py +148 -0
  136. streamlit/runtime/websocket_session_manager.py +3 -1
  137. streamlit/source_util.py +2 -2
  138. streamlit/static/index.html +2 -2
  139. streamlit/static/manifest.json +244 -227
  140. streamlit/static/static/css/{index.C8X8rNzw.css → index.BpABIXK9.css} +1 -1
  141. streamlit/static/static/css/index.DgR7E2CV.css +1 -0
  142. streamlit/static/static/js/{ErrorOutline.esm.DcGrhbBP.js → ErrorOutline.esm.YoJdlW1p.js} +1 -1
  143. streamlit/static/static/js/{FileDownload.esm.DgBvV6Pq.js → FileDownload.esm.Ddx8VEYy.js} +1 -1
  144. streamlit/static/static/js/{FileHelper.M6AAaeuA.js → FileHelper.90EtOmj9.js} +1 -1
  145. streamlit/static/static/js/{FormClearHelper.DHh1GFzm.js → FormClearHelper.BB1Km6eP.js} +1 -1
  146. streamlit/static/static/js/InputInstructions.jhH15PqV.js +1 -0
  147. streamlit/static/static/js/{Particles.DDVT-6Qc.js → Particles.DUsputn1.js} +1 -1
  148. streamlit/static/static/js/{ProgressBar.BEY0cXXV.js → ProgressBar.DLY8H6nE.js} +2 -2
  149. streamlit/static/static/js/Toolbar.D8nHCkuz.js +1 -0
  150. streamlit/static/static/js/{base-input.CK3UVGp1.js → base-input.CJGiNqed.js} +3 -3
  151. streamlit/static/static/js/{checkbox.D8W881TL.js → checkbox.Cpdd482O.js} +1 -1
  152. streamlit/static/static/js/{createSuper.B6W-Dh9S.js → createSuper.CuQIogbW.js} +1 -1
  153. streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +1 -0
  154. streamlit/static/static/js/{downloader.DiKpuU_S.js → downloader.CN0K7xlu.js} +1 -1
  155. streamlit/static/static/js/{es6.B8zRNPZ-.js → es6.BJcsVXQ0.js} +2 -2
  156. streamlit/static/static/js/{iframeResizer.contentWindow.DIewJmmh.js → iframeResizer.contentWindow.XzUvQqcZ.js} +1 -1
  157. streamlit/static/static/js/index.B1ZQh4P1.js +1 -0
  158. streamlit/static/static/js/index.BKstZk0M.js +27 -0
  159. streamlit/static/static/js/{index.Bte_9Lyq.js → index.BMcFsUee.js} +1 -1
  160. streamlit/static/static/js/{index.qhs54UAB.js → index.BR-IdcTb.js} +1 -1
  161. streamlit/static/static/js/{index.CejBxbg1.js → index.B_dWA3vd.js} +1 -1
  162. streamlit/static/static/js/{index.D5naqx-J.js → index.BgnZEMVh.js} +1 -1
  163. streamlit/static/static/js/{index.C7fRKRs4.js → index.BohqXifI.js} +1 -1
  164. streamlit/static/static/js/{index.cnnXF7xQ.js → index.Br5nxKNj.js} +1 -1
  165. streamlit/static/static/js/index.BrIKVbNc.js +3 -0
  166. streamlit/static/static/js/index.BtWUPzle.js +1 -0
  167. streamlit/static/static/js/index.C0RLraek.js +1 -0
  168. streamlit/static/static/js/{index.CP5TD2z1.js → index.CAIjskgG.js} +1 -1
  169. streamlit/static/static/js/{index.CD8HuT3N.js → index.CAj-7vWz.js} +135 -162
  170. streamlit/static/static/js/{index.DtYN2x4k.js → index.CMtEit2O.js} +1 -1
  171. streamlit/static/static/js/index.CkRlykEE.js +12 -0
  172. streamlit/static/static/js/{index.Ts_0SdB9.js → index.CmN3FXfI.js} +2 -2
  173. streamlit/static/static/js/{index.BnEpvLEz.js → index.CwbFI1_-.js} +1 -1
  174. streamlit/static/static/js/{index.CcJf6BCU.js → index.CxIUUfab.js} +27 -27
  175. streamlit/static/static/js/index.D2KPNy7e.js +1 -0
  176. streamlit/static/static/js/{index.Ch7MBCx0.js → index.D3GPA5k4.js} +47 -47
  177. streamlit/static/static/js/{index.ho6NIXGl.js → index.DGAh7DMq.js} +1 -1
  178. streamlit/static/static/js/index.DKb_NvmG.js +197 -0
  179. streamlit/static/static/js/{index.CvYYtxD_.js → index.DMqgUYKq.js} +1 -1
  180. streamlit/static/static/js/{index.zecpGxtj.js → index.DOFlg3dS.js} +1 -1
  181. streamlit/static/static/js/{index.B9mjBcgE.js → index.DPUXkcQL.js} +1 -1
  182. streamlit/static/static/js/index.DX1xY89g.js +1 -0
  183. streamlit/static/static/js/index.DYATBCsq.js +2 -0
  184. streamlit/static/static/js/{index.D2-atlaQ.js → index.DaSmGJ76.js} +3 -3
  185. streamlit/static/static/js/index.Dd7bMeLP.js +1 -0
  186. streamlit/static/static/js/{index.4eF4NxG2.js → index.DjmmgI5U.js} +1 -1
  187. streamlit/static/static/js/index.Dq56CyM2.js +1 -0
  188. streamlit/static/static/js/index.DuiXaS5_.js +7 -0
  189. streamlit/static/static/js/index.DvFidMLe.js +2 -0
  190. streamlit/static/static/js/{index.452cqrrL.js → index.DwkhC5Pc.js} +1 -1
  191. streamlit/static/static/js/{index.Dk4C7X3i.js → index.Q-3sFn1v.js} +1 -1
  192. streamlit/static/static/js/{index.CjXWwH-y.js → index.QJ5QO9sJ.js} +1 -1
  193. streamlit/static/static/js/{index.B6U8LQo3.js → index.VwTaeety.js} +1 -1
  194. streamlit/static/static/js/index.YOqQbeX8.js +1 -0
  195. streamlit/static/static/js/{input.nzVJphXi.js → input.D4MN_FzN.js} +1 -1
  196. streamlit/static/static/js/{memory.CjCgTQz3.js → memory.DrZjtdGT.js} +1 -1
  197. streamlit/static/static/js/{number-overlay-editor.DaRFzZEO.js → number-overlay-editor.DRwAw1In.js} +1 -1
  198. streamlit/static/static/js/{possibleConstructorReturn.DgiPnZ9N.js → possibleConstructorReturn.exeeJQEP.js} +1 -1
  199. streamlit/static/static/js/record.B-tDciZb.js +1 -0
  200. streamlit/static/static/js/{sandbox.mithfq7Z.js → sandbox.ClO3IuUr.js} +1 -1
  201. streamlit/static/static/js/{timepicker.Dbl5KFh6.js → timepicker.DAhu-vcF.js} +4 -4
  202. streamlit/static/static/js/{toConsumableArray.D-Dx88BQ.js → toConsumableArray.DNbljYEC.js} +1 -1
  203. streamlit/static/static/js/{uniqueId.Bh26R_3S.js → uniqueId.oG4Gvj1v.js} +1 -1
  204. streamlit/static/static/js/{useBasicWidgetState.DeK-QJpD.js → useBasicWidgetState.D6sOH6oI.js} +1 -1
  205. streamlit/static/static/js/{useTextInputAutoExpand.4iAdLWD-.js → useTextInputAutoExpand.4u3_GcuN.js} +2 -2
  206. streamlit/static/static/js/{useUpdateUiValue.CmT7_nJN.js → useUpdateUiValue.F2R3eTeR.js} +1 -1
  207. streamlit/static/static/js/wavesurfer.esm.vI8Eid4k.js +73 -0
  208. streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +1 -0
  209. streamlit/static/static/media/MaterialSymbols-Rounded.C7IFxh57.woff2 +0 -0
  210. streamlit/string_util.py +56 -1
  211. streamlit/testing/v1/app_test.py +2 -2
  212. streamlit/testing/v1/element_tree.py +23 -9
  213. streamlit/testing/v1/util.py +2 -2
  214. streamlit/type_util.py +3 -4
  215. streamlit/url_util.py +1 -3
  216. streamlit/user_info.py +1 -2
  217. streamlit/util.py +3 -1
  218. streamlit/watcher/event_based_path_watcher.py +23 -12
  219. streamlit/watcher/local_sources_watcher.py +11 -1
  220. streamlit/watcher/path_watcher.py +9 -6
  221. streamlit/watcher/polling_path_watcher.py +4 -1
  222. streamlit/watcher/util.py +2 -2
  223. streamlit/web/bootstrap.py +0 -31
  224. streamlit/web/cli.py +51 -22
  225. streamlit/web/server/bidi_component_request_handler.py +193 -0
  226. streamlit/web/server/component_file_utils.py +97 -0
  227. streamlit/web/server/component_request_handler.py +8 -21
  228. streamlit/web/server/oidc_mixin.py +3 -1
  229. streamlit/web/server/routes.py +18 -5
  230. streamlit/web/server/server.py +10 -0
  231. streamlit/web/server/server_util.py +3 -1
  232. streamlit/web/server/upload_file_request_handler.py +3 -1
  233. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/METADATA +4 -5
  234. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/RECORD +238 -209
  235. streamlit/static/static/css/index.COe1010n.css +0 -1
  236. streamlit/static/static/js/Hooks.DGu1od_L.js +0 -1
  237. streamlit/static/static/js/InputInstructions.z6sVgyYt.js +0 -1
  238. streamlit/static/static/js/Toolbar.DSnK1fUh.js +0 -1
  239. streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +0 -1
  240. streamlit/static/static/js/index.BXYmrqnf.js +0 -1
  241. streamlit/static/static/js/index.B_8AnktO.js +0 -1
  242. streamlit/static/static/js/index.Bl7zGQSh.js +0 -7
  243. streamlit/static/static/js/index.BnJIOYn9.js +0 -73
  244. streamlit/static/static/js/index.C1HcTl5K.js +0 -1
  245. streamlit/static/static/js/index.C7lSmSOP.js +0 -1
  246. streamlit/static/static/js/index.C_tmcx4B.js +0 -1
  247. streamlit/static/static/js/index.D3K5nOu9.js +0 -197
  248. streamlit/static/static/js/index.DkKT3LUI.js +0 -1
  249. streamlit/static/static/js/index.MTPPBDHk.js +0 -2
  250. streamlit/static/static/js/index.pqW9AMJD.js +0 -3
  251. streamlit/static/static/js/index.urHgTgMQ.js +0 -12
  252. streamlit/static/static/js/index.wzkv_11M.js +0 -1
  253. streamlit/static/static/js/index.yF5AncHY.js +0 -1
  254. streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +0 -1
  255. streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
  256. {streamlit-1.49.1.data → streamlit-1.51.0.data}/scripts/streamlit.cmd +0 -0
  257. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/WHEEL +0 -0
  258. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/entry_points.txt +0 -0
  259. {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/top_level.txt +0 -0
@@ -21,15 +21,25 @@ from typing import (
21
21
  Any,
22
22
  Final,
23
23
  Literal,
24
+ TypeAlias,
24
25
  TypedDict,
25
26
  cast,
26
27
  overload,
27
28
  )
28
29
 
29
- from typing_extensions import TypeAlias
30
-
31
30
  from streamlit import config
31
+ from streamlit.deprecation_util import (
32
+ make_deprecated_name_warning,
33
+ show_deprecation_warning,
34
+ )
32
35
  from streamlit.elements.lib.form_utils import current_form_id
36
+ from streamlit.elements.lib.layout_utils import (
37
+ HeightWithoutContent,
38
+ LayoutConfig,
39
+ WidthWithoutContent,
40
+ validate_height,
41
+ validate_width,
42
+ )
33
43
  from streamlit.elements.lib.policies import check_widget_policies
34
44
  from streamlit.elements.lib.utils import Key, compute_and_register_element_id, to_key
35
45
  from streamlit.errors import StreamlitAPIException
@@ -263,9 +273,9 @@ class PydeckMixin:
263
273
  self,
264
274
  pydeck_obj: Deck | None = None,
265
275
  *,
266
- use_container_width: bool = True,
267
- width: int | None = None,
268
- height: int | None = None,
276
+ width: WidthWithoutContent = "stretch",
277
+ use_container_width: bool | None = None,
278
+ height: HeightWithoutContent = 500,
269
279
  selection_mode: Literal[
270
280
  "single-object"
271
281
  ], # Selection mode will only be activated by on_select param; default value here to make it work with mypy
@@ -279,9 +289,9 @@ class PydeckMixin:
279
289
  self,
280
290
  pydeck_obj: Deck | None = None,
281
291
  *,
282
- use_container_width: bool = True,
283
- width: int | None = None,
284
- height: int | None = None,
292
+ width: WidthWithoutContent = "stretch",
293
+ use_container_width: bool | None = None,
294
+ height: HeightWithoutContent = 500,
285
295
  selection_mode: SelectionMode = "single-object",
286
296
  on_select: Literal["rerun"] | WidgetCallback = "rerun",
287
297
  key: Key | None = None,
@@ -292,9 +302,9 @@ class PydeckMixin:
292
302
  self,
293
303
  pydeck_obj: Deck | None = None,
294
304
  *,
295
- use_container_width: bool = True,
296
- width: int | None = None,
297
- height: int | None = None,
305
+ width: WidthWithoutContent = "stretch",
306
+ use_container_width: bool | None = None,
307
+ height: HeightWithoutContent = 500,
298
308
  selection_mode: SelectionMode = "single-object",
299
309
  on_select: Literal["rerun", "ignore"] | WidgetCallback = "ignore",
300
310
  key: Key | None = None,
@@ -342,26 +352,43 @@ class PydeckMixin:
342
352
  ----------
343
353
  pydeck_obj : pydeck.Deck or None
344
354
  Object specifying the PyDeck chart to draw.
345
- use_container_width : bool
346
- Whether to override the figure's native width with the width of
347
- the parent container. If ``use_container_width`` is ``True`` (default),
348
- Streamlit sets the width of the figure to match the width of the parent
349
- container. If ``use_container_width`` is ``False``, Streamlit sets the
350
- width of the chart to fit its contents according to the plotting library,
351
- up to the width of the parent container.
352
- width : int or None
353
- Desired width of the chart expressed in pixels. If ``width`` is
354
- ``None`` (default), Streamlit sets the width of the chart to fit
355
- its contents according to the plotting library, up to the width of
356
- the parent container. If ``width`` is greater than the width of the
357
- parent container, Streamlit sets the chart width to match the width
358
- of the parent container.
359
-
360
- To use ``width``, you must set ``use_container_width=False``.
361
- height : int or None
362
- Desired height of the chart expressed in pixels. If ``height`` is
363
- ``None`` (default), Streamlit sets the height of the chart to fit
364
- its contents according to the plotting library.
355
+ width : "stretch" or int
356
+ The width of the chart element. This can be one of the following:
357
+
358
+ - ``"stretch"`` (default): The width of the element matches the
359
+ width of the parent container.
360
+ - An integer specifying the width in pixels: The element has a
361
+ fixed width. If the specified width is greater than the width of
362
+ the parent container, the width of the element matches the width
363
+ of the parent container.
364
+
365
+ use_container_width : bool or None
366
+ Whether to override the chart's native width with the width of
367
+ the parent container. This can be one of the following:
368
+
369
+ - ``None`` (default): Streamlit will use the chart's default behavior.
370
+ - ``True``: Streamlit sets the width of the chart to match the
371
+ width of the parent container.
372
+ - ``False``: Streamlit sets the width of the chart to fit its
373
+ contents according to the plotting library, up to the width of
374
+ the parent container.
375
+
376
+ .. deprecated::
377
+ ``use_container_width`` is deprecated and will be removed in a
378
+ future release. For ``use_container_width=True``, use
379
+ ``width="stretch"``.
380
+
381
+ height : "stretch" or int
382
+ The height of the chart element. This can be one of the following:
383
+
384
+ - An integer specifying the height in pixels: The element has a
385
+ fixed height. If the content is larger than the specified
386
+ height, scrolling is enabled. This is ``500`` by default.
387
+ - ``"stretch"``: The height of the element matches the height of
388
+ its content or the height of the parent container, whichever is
389
+ larger. If the element is not in a parent container, the height
390
+ of the element matches the height of its content.
391
+
365
392
  on_select : "ignore" or "rerun" or callable
366
393
  How the figure should respond to user selection events. This controls
367
394
  whether or not the chart behaves like an input widget.
@@ -460,6 +487,25 @@ class PydeckMixin:
460
487
  you can set ``map_style=None`` in the ``pydeck.Deck`` object.
461
488
 
462
489
  """
490
+ if use_container_width is not None:
491
+ show_deprecation_warning(
492
+ make_deprecated_name_warning(
493
+ "use_container_width",
494
+ "width",
495
+ "2025-12-31",
496
+ "For `use_container_width=True`, use `width='stretch'`. "
497
+ "For `use_container_width=False`, specify an integer width.",
498
+ include_st_prefix=False,
499
+ ),
500
+ show_in_browser=False,
501
+ )
502
+ if use_container_width:
503
+ width = "stretch"
504
+ # Otherwise keep the provided width.
505
+
506
+ validate_width(width, allow_content=False)
507
+ validate_height(height, allow_content=False)
508
+
463
509
  pydeck_proto = PydeckProto()
464
510
 
465
511
  ctx = get_script_run_ctx()
@@ -467,12 +513,6 @@ class PydeckMixin:
467
513
  spec = json.dumps(EMPTY_MAP) if pydeck_obj is None else pydeck_obj.to_json()
468
514
 
469
515
  pydeck_proto.json = spec
470
- pydeck_proto.use_container_width = use_container_width
471
-
472
- if width:
473
- pydeck_proto.width = width
474
- if height:
475
- pydeck_proto.height = height
476
516
 
477
517
  tooltip = _get_pydeck_tooltip(pydeck_obj)
478
518
  if tooltip:
@@ -516,6 +556,7 @@ class PydeckMixin:
516
556
  pydeck_proto.id = compute_and_register_element_id(
517
557
  "deck_gl_json_chart",
518
558
  user_key=key,
559
+ key_as_main_identity=False,
519
560
  dg=self.dg,
520
561
  is_selection_activated=is_selection_activated,
521
562
  selection_mode=selection_mode,
@@ -534,11 +575,17 @@ class PydeckMixin:
534
575
  value_type="string_value",
535
576
  )
536
577
 
537
- self.dg._enqueue("deck_gl_json_chart", pydeck_proto)
578
+ layout_config = LayoutConfig(width=width, height=height)
579
+ self.dg._enqueue(
580
+ "deck_gl_json_chart", pydeck_proto, layout_config=layout_config
581
+ )
538
582
 
539
583
  return widget_state.value
540
584
 
541
- return self.dg._enqueue("deck_gl_json_chart", pydeck_proto)
585
+ layout_config = LayoutConfig(width=width, height=height)
586
+ return self.dg._enqueue(
587
+ "deck_gl_json_chart", pydeck_proto, layout_config=layout_config
588
+ )
542
589
 
543
590
  @property
544
591
  def dg(self) -> DeltaGenerator:
@@ -546,6 +593,18 @@ class PydeckMixin:
546
593
  return cast("DeltaGenerator", self)
547
594
 
548
595
 
596
+ def _get_pydeck_width(pydeck_obj: Deck | None) -> int | None:
597
+ """Extract the width from a pydeck Deck object, if specified."""
598
+ if pydeck_obj is None:
599
+ return None
600
+
601
+ width = getattr(pydeck_obj, "width", None)
602
+ if width is not None and isinstance(width, (int, float)):
603
+ return int(width)
604
+
605
+ return None
606
+
607
+
549
608
  def _get_pydeck_tooltip(pydeck_obj: Deck | None) -> dict[str, str] | None:
550
609
  if pydeck_obj is None:
551
610
  return None
@@ -14,8 +14,9 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
+ from collections.abc import Callable
17
18
  from functools import wraps
18
- from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, cast, overload
19
+ from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast, overload
19
20
 
20
21
  from streamlit.delta_generator_singletons import (
21
22
  get_dg_singleton_instance,
@@ -16,7 +16,7 @@ from __future__ import annotations
16
16
 
17
17
  import os
18
18
  import traceback
19
- from typing import TYPE_CHECKING, Callable, Final, TypeVar, cast
19
+ from typing import TYPE_CHECKING, Final, TypeVar, cast
20
20
 
21
21
  from streamlit import config
22
22
  from streamlit.elements.lib.layout_utils import validate_width
@@ -31,6 +31,8 @@ from streamlit.runtime.metrics_util import gather_metrics
31
31
  from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
32
32
 
33
33
  if TYPE_CHECKING:
34
+ from collections.abc import Callable
35
+
34
36
  from streamlit.delta_generator import DeltaGenerator
35
37
  from streamlit.elements.lib.layout_utils import WidthWithoutContent
36
38
 
@@ -350,6 +350,12 @@ class FormMixin:
350
350
  In both cases, if the contents of the button are wider than the
351
351
  parent container, the contents will line wrap.
352
352
 
353
+ .. deprecated::
354
+ ``use_container_width`` is deprecated and will be removed in a
355
+ future release. For ``use_container_width=True``, use
356
+ ``width="stretch"``. For ``use_container_width=False``, use
357
+ ``width="content"``.
358
+
353
359
  width : "content", "stretch", or int
354
360
  The width of the button. This can be one of the following:
355
361
 
@@ -363,12 +369,6 @@ class FormMixin:
363
369
  the parent container, the width of the button matches the width
364
370
  of the parent container.
365
371
 
366
- .. deprecated::
367
- ``use_container_width`` is deprecated and will be removed in a
368
- future release. For ``use_container_width=True``, use
369
- ``width="stretch"``. For ``use_container_width=False``, use
370
- ``width="content"``.
371
-
372
372
  Returns
373
373
  -------
374
374
  bool
@@ -16,9 +16,7 @@
16
16
 
17
17
  from __future__ import annotations
18
18
 
19
- from typing import TYPE_CHECKING, Union, cast
20
-
21
- from typing_extensions import TypeAlias
19
+ from typing import TYPE_CHECKING, TypeAlias, Union, cast
22
20
 
23
21
  from streamlit import type_util
24
22
  from streamlit.deprecation_util import (
@@ -26,8 +24,10 @@ from streamlit.deprecation_util import (
26
24
  show_deprecation_warning,
27
25
  )
28
26
  from streamlit.elements.lib.layout_utils import (
27
+ Height,
29
28
  LayoutConfig,
30
29
  Width,
30
+ validate_height,
31
31
  validate_width,
32
32
  )
33
33
  from streamlit.errors import StreamlitAPIException
@@ -53,6 +53,7 @@ class GraphvizMixin:
53
53
  use_container_width: bool | None = None,
54
54
  *, # keyword-only arguments:
55
55
  width: Width = "content",
56
+ height: Height = "content",
56
57
  ) -> DeltaGenerator:
57
58
  """Display a graph using the dagre-d3 library.
58
59
 
@@ -78,6 +79,12 @@ class GraphvizMixin:
78
79
  container. If ``use_container_width`` is ``True``, Streamlit sets
79
80
  the width of the figure to match the width of the parent container.
80
81
 
82
+ .. deprecated::
83
+ ``use_container_width`` is deprecated and will be removed in a
84
+ future release. For ``use_container_width=True``, use
85
+ ``width="stretch"``. For ``use_container_width=False``, use
86
+ ``width="content"``.
87
+
81
88
  width : "content", "stretch", or int
82
89
  The width of the chart element. This can be one of the following:
83
90
 
@@ -91,11 +98,18 @@ class GraphvizMixin:
91
98
  the parent container, the width of the element matches the width
92
99
  of the parent container.
93
100
 
94
- .. deprecated::
95
- ``use_container_width`` is deprecated and will be removed in a
96
- future release. For ``use_container_width=True``, use
97
- ``width="stretch"``. For ``use_container_width=False``, use
98
- ``width="content"``.
101
+ height : "content", "stretch", or int
102
+ The height of the chart element. This can be one of the following:
103
+
104
+ - ``"content"`` (default): The height of the element matches the
105
+ height of its content.
106
+ - ``"stretch"``: The height of the element matches the height of
107
+ its content or the height of the parent container, whichever is
108
+ larger. If the element is not in a parent container, the height
109
+ of the element matches the height of its content.
110
+ - An integer specifying the height in pixels: The element has a
111
+ fixed height. If the content is larger than the specified
112
+ height, scrolling is enabled.
99
113
 
100
114
  Example
101
115
  -------
@@ -170,7 +184,8 @@ class GraphvizMixin:
170
184
 
171
185
  # Validate and set layout configuration
172
186
  validate_width(width, allow_content=True)
173
- layout_config = LayoutConfig(width=width)
187
+ validate_height(height, allow_content=True)
188
+ layout_config = LayoutConfig(width=width, height=height)
174
189
 
175
190
  return self.dg._enqueue(
176
191
  "graphviz_chart", graphviz_chart_proto, layout_config=layout_config
@@ -15,9 +15,7 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  from enum import Enum
18
- from typing import TYPE_CHECKING, Literal, Union, cast
19
-
20
- from typing_extensions import TypeAlias
18
+ from typing import TYPE_CHECKING, Literal, TypeAlias, cast
21
19
 
22
20
  from streamlit.elements.lib.layout_utils import LayoutConfig, validate_width
23
21
  from streamlit.errors import StreamlitAPIException
@@ -37,8 +35,8 @@ class HeadingProtoTag(Enum):
37
35
  SUBHEADER_TAG = "h3"
38
36
 
39
37
 
40
- Anchor: TypeAlias = Union[str, Literal[False], None]
41
- Divider: TypeAlias = Union[bool, str, None]
38
+ Anchor: TypeAlias = str | Literal[False] | None
39
+ Divider: TypeAlias = bool | str | None
42
40
 
43
41
 
44
42
  class HeadingMixin:
@@ -99,7 +99,6 @@ class IframeMixin:
99
99
  scrolling=scrolling,
100
100
  tab_index=tab_index,
101
101
  )
102
- # When no width is specified, we want the iframe to stretch to fill the container.
103
102
  layout_config = LayoutConfig(
104
103
  width=width if width is not None else "stretch",
105
104
  height=height if height is not None else 150,
@@ -184,7 +183,6 @@ class IframeMixin:
184
183
  scrolling=scrolling,
185
184
  tab_index=tab_index,
186
185
  )
187
- # When no width is specified, we want the html to stretch to fill the container.
188
186
  layout_config = LayoutConfig(
189
187
  width=width if width is not None else "stretch",
190
188
  height=height if height is not None else 150,
@@ -21,9 +21,7 @@
21
21
 
22
22
  from __future__ import annotations
23
23
 
24
- from typing import TYPE_CHECKING, Literal, Union, cast
25
-
26
- from typing_extensions import TypeAlias
24
+ from typing import TYPE_CHECKING, Literal, TypeAlias, cast
27
25
 
28
26
  from streamlit.deprecation_util import (
29
27
  make_deprecated_name_warning,
@@ -43,7 +41,7 @@ from streamlit.runtime.metrics_util import gather_metrics
43
41
  if TYPE_CHECKING:
44
42
  from streamlit.delta_generator import DeltaGenerator
45
43
 
46
- UseColumnWith: TypeAlias = Union[Literal["auto", "always", "never"], bool, None]
44
+ UseColumnWith: TypeAlias = Literal["auto", "always", "never"] | bool | None
47
45
 
48
46
 
49
47
  class ImageMixin:
@@ -115,6 +113,11 @@ class ImageMixin:
115
113
  If "always" or True, set the image's width to the column width.
116
114
  If "never" or False, set the image's width to its natural size.
117
115
  Note: if set, `use_column_width` takes precedence over the `width` parameter.
116
+
117
+ .. deprecated::
118
+ ``use_column_width`` is deprecated and will be removed in a future
119
+ release. Please use the ``width`` parameter instead.
120
+
118
121
  clamp : bool
119
122
  Whether to clamp image pixel values to a valid range (0-255 per
120
123
  channel). This is only used for byte array images; the parameter is
@@ -142,15 +145,11 @@ class ImageMixin:
142
145
  ``use_container_width`` is ``True``, Streamlit sets the width of
143
146
  the image to match the width of the parent container.
144
147
 
145
- .. deprecated::
146
- ``use_container_width`` is deprecated and will be removed in a
147
- future release. For ``use_container_width=True``, use
148
- ``width="stretch"``. For ``use_container_width=False``, use
149
- ``width="content"``.
150
-
151
- .. deprecated::
152
- ``use_column_width`` is deprecated and will be removed in a future
153
- release. Please use the ``width`` parameter instead.
148
+ .. deprecated::
149
+ ``use_container_width`` is deprecated and will be removed in a
150
+ future release. For ``use_container_width=True``, use
151
+ ``width="stretch"``. For ``use_container_width=False``, use
152
+ ``width="content"``.
154
153
 
155
154
  Example
156
155
  -------
@@ -15,9 +15,7 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  from collections.abc import Sequence
18
- from typing import TYPE_CHECKING, Literal, Union, cast
19
-
20
- from typing_extensions import TypeAlias
18
+ from typing import TYPE_CHECKING, Literal, TypeAlias, cast
21
19
 
22
20
  from streamlit.delta_generator_singletons import get_dg_singleton_instance
23
21
  from streamlit.elements.lib.layout_utils import (
@@ -54,7 +52,7 @@ if TYPE_CHECKING:
54
52
  from streamlit.elements.lib.mutable_status_container import StatusContainer
55
53
  from streamlit.runtime.state import WidgetCallback
56
54
 
57
- SpecType: TypeAlias = Union[int, Sequence[Union[int, float]]]
55
+ SpecType: TypeAlias = int | Sequence[int | float]
58
56
 
59
57
 
60
58
  class LayoutsMixin:
@@ -323,7 +321,7 @@ class LayoutsMixin:
323
321
  # in the future. This might require including more container
324
322
  # parameters in the ID calculation.
325
323
  block_proto.id = compute_and_register_element_id(
326
- "container", user_key=key, dg=None
324
+ "container", user_key=key, dg=None, key_as_main_identity=False
327
325
  )
328
326
 
329
327
  return self.dg._block(block_proto)
@@ -385,13 +383,15 @@ class LayoutsMixin:
385
383
  ``False`` (default), no border is shown. If this is ``True``, a
386
384
  border is shown around each column.
387
385
 
388
- width : int or "stretch"
389
- The desired width of the columns expressed in pixels. If this is
390
- ``"stretch"`` (default), Streamlit sets the width of the columns to
391
- match the width of the parent container. Otherwise, this must be an
392
- integer. If the specified width is greater than the width of the
393
- parent container, Streamlit sets the width of the columns to match
394
- the width of the parent container.
386
+ width : "stretch" or int
387
+ The width of the column group. This can be one of the following:
388
+
389
+ - ``"stretch"`` (default): The width of the column group matches the
390
+ width of the parent container.
391
+ - An integer specifying the width in pixels: The column group has a
392
+ fixed width. If the specified width is greater than the width of
393
+ the parent container, the width of the column group matches the
394
+ width of the parent container.
395
395
 
396
396
  Returns
397
397
  -------
@@ -559,6 +559,7 @@ class LayoutsMixin:
559
559
  tabs: Sequence[str],
560
560
  *,
561
561
  width: WidthWithoutContent = "stretch",
562
+ default: str | None = None,
562
563
  ) -> Sequence[DeltaGenerator]:
563
564
  r"""Insert containers separated into tabs.
564
565
 
@@ -568,7 +569,7 @@ class LayoutsMixin:
568
569
 
569
570
  To add elements to the returned containers, you can use the ``with`` notation
570
571
  (preferred) or just call methods directly on the returned object. See
571
- examples below.
572
+ the examples below.
572
573
 
573
574
  .. note::
574
575
  All content within every tab is computed and sent to the frontend,
@@ -608,6 +609,12 @@ class LayoutsMixin:
608
609
  the parent container, the width of the container matches the width
609
610
  of the parent container.
610
611
 
612
+ default : str or None
613
+ The default tab to select. If this is ``None`` (default), the first
614
+ tab is selected. If this is a string, it must be one of the tab
615
+ labels. If two tabs have the same label as ``default``, the first
616
+ one is selected.
617
+
611
618
  Returns
612
619
  -------
613
620
  list of containers
@@ -615,7 +622,9 @@ class LayoutsMixin:
615
622
 
616
623
  Examples
617
624
  --------
618
- You can use the ``with`` notation to insert any element into a tab:
625
+ *Example 1: Use context management*
626
+
627
+ You can use ``with`` notation to insert any element into a tab:
619
628
 
620
629
  >>> import streamlit as st
621
630
  >>>
@@ -635,7 +644,9 @@ class LayoutsMixin:
635
644
  https://doc-tabs1.streamlit.app/
636
645
  height: 620px
637
646
 
638
- Or you can just call methods directly on the returned objects:
647
+ *Example 2: Call methods directly*
648
+
649
+ You can call methods directly on the returned objects:
639
650
 
640
651
  >>> import streamlit as st
641
652
  >>> from numpy.random import default_rng as rng
@@ -654,12 +665,42 @@ class LayoutsMixin:
654
665
  https://doc-tabs2.streamlit.app/
655
666
  height: 700px
656
667
 
668
+ *Example 3: Set the default tab and style the tab labels*
669
+
670
+ Use the ``default`` parameter to set the default tab. You can also use
671
+ Markdown in the tab labels.
672
+
673
+ >>> import streamlit as st
674
+ >>>
675
+ >>> tab1, tab2, tab3 = st.tabs(
676
+ ... [":cat: Cat", ":dog: Dog", ":rainbow[Owl]"], default=":rainbow[Owl]"
677
+ ... )
678
+ >>>
679
+ >>> with tab1:
680
+ >>> st.header("A cat")
681
+ >>> st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
682
+ >>> with tab2:
683
+ >>> st.header("A dog")
684
+ >>> st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
685
+ >>> with tab3:
686
+ >>> st.header("An owl")
687
+ >>> st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
688
+
689
+ .. output ::
690
+ https://doc-tabs3.streamlit.app/
691
+ height: 620px
692
+
657
693
  """
658
694
  if not tabs:
659
695
  raise StreamlitAPIException(
660
696
  "The input argument to st.tabs must contain at least one tab label."
661
697
  )
662
698
 
699
+ if default and default not in tabs:
700
+ raise StreamlitAPIException(
701
+ f"The default tab '{default}' is not in the list of tabs."
702
+ )
703
+
663
704
  if any(not isinstance(tab, str) for tab in tabs):
664
705
  raise StreamlitAPIException(
665
706
  "The tabs input list to st.tabs is only allowed to contain strings."
@@ -675,8 +716,14 @@ class LayoutsMixin:
675
716
  block_proto.tab_container.SetInParent()
676
717
  validate_width(width)
677
718
  block_proto.width_config.CopyFrom(get_width_config(width))
719
+
720
+ default_index = tabs.index(default) if default else 0
721
+
722
+ block_proto.tab_container.default_tab_index = default_index
723
+
678
724
  tab_container = self.dg._block(block_proto)
679
- return tuple(tab_container._block(tab_proto(tab_label)) for tab_label in tabs)
725
+
726
+ return tuple(tab_container._block(tab_proto(tab)) for tab in tabs)
680
727
 
681
728
  @gather_metrics("expander")
682
729
  def expander(
@@ -815,6 +862,7 @@ class LayoutsMixin:
815
862
  self,
816
863
  label: str,
817
864
  *,
865
+ type: Literal["primary", "secondary", "tertiary"] = "secondary",
818
866
  help: str | None = None,
819
867
  icon: str | None = None,
820
868
  disabled: bool = False,
@@ -865,6 +913,17 @@ class LayoutsMixin:
865
913
  including the Markdown directives described in the ``body``
866
914
  parameter of ``st.markdown``.
867
915
 
916
+ type : "primary", "secondary", or "tertiary"
917
+ An optional string that specifies the button type. This can be one
918
+ of the following:
919
+
920
+ - ``"primary"``: The button's background is the app's primary color
921
+ for additional emphasis.
922
+ - ``"secondary"`` (default): The button's background coordinates
923
+ with the app's background color for normal emphasis.
924
+ - ``"tertiary"``: The button is plain text without a border or
925
+ background for subtlety.
926
+
868
927
  icon : str
869
928
  An optional emoji or icon to display next to the button label. If ``icon``
870
929
  is ``None`` (default), no icon is displayed. If ``icon`` is a
@@ -899,6 +958,12 @@ class LayoutsMixin:
899
958
  button. The popover container may be wider than its button to fit
900
959
  the container's content.
901
960
 
961
+ .. deprecated::
962
+ ``use_container_width`` is deprecated and will be removed in a
963
+ future release. For ``use_container_width=True``, use
964
+ ``width="stretch"``. For ``use_container_width=False``, use
965
+ ``width="content"``.
966
+
902
967
  width : int, "stretch", or "content"
903
968
  The width of the button. This can be one of the following:
904
969
 
@@ -916,12 +981,6 @@ class LayoutsMixin:
916
981
  button. The popover container may be wider than its button to fit
917
982
  the container's contents.
918
983
 
919
- .. deprecated::
920
- ``use_container_width`` is deprecated and will be removed in a
921
- future release. For ``use_container_width=True``, use
922
- ``width="stretch"``. For ``use_container_width=False``, use
923
- ``width="content"``.
924
-
925
984
  Examples
926
985
  --------
927
986
  You can use the ``with`` notation to insert any element into a popover:
@@ -962,9 +1021,17 @@ class LayoutsMixin:
962
1021
  if use_container_width is not None:
963
1022
  width = "stretch" if use_container_width else "content"
964
1023
 
1024
+ # Checks whether the entered button type is one of the allowed options
1025
+ if type not in ["primary", "secondary", "tertiary"]:
1026
+ raise StreamlitAPIException(
1027
+ 'The type argument to st.popover must be "primary", "secondary", or "tertiary". '
1028
+ f'\nThe argument passed was "{type}".'
1029
+ )
1030
+
965
1031
  popover_proto = BlockProto.Popover()
966
1032
  popover_proto.label = label
967
1033
  popover_proto.disabled = disabled
1034
+ popover_proto.type = type
968
1035
  if help:
969
1036
  popover_proto.help = str(help)
970
1037
  if icon is not None: