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.
- streamlit/__init__.py +4 -1
- streamlit/column_config.py +2 -0
- streamlit/commands/navigation.py +7 -7
- streamlit/commands/page_config.py +4 -6
- streamlit/components/v1/custom_component.py +17 -42
- streamlit/components/v2/__init__.py +458 -0
- streamlit/components/v2/bidi_component/__init__.py +20 -0
- streamlit/components/v2/bidi_component/constants.py +29 -0
- streamlit/components/v2/bidi_component/main.py +386 -0
- streamlit/components/v2/bidi_component/serialization.py +265 -0
- streamlit/components/v2/bidi_component/state.py +92 -0
- streamlit/components/v2/component_definition_resolver.py +143 -0
- streamlit/components/v2/component_file_watcher.py +403 -0
- streamlit/components/v2/component_manager.py +431 -0
- streamlit/components/v2/component_manifest_handler.py +122 -0
- streamlit/components/v2/component_path_utils.py +245 -0
- streamlit/components/v2/component_registry.py +409 -0
- streamlit/components/v2/get_bidi_component_manager.py +51 -0
- streamlit/components/v2/manifest_scanner.py +615 -0
- streamlit/components/v2/presentation.py +198 -0
- streamlit/components/v2/types.py +324 -0
- streamlit/config.py +741 -32
- streamlit/config_option.py +4 -1
- streamlit/config_util.py +650 -1
- streamlit/connections/base_connection.py +4 -2
- streamlit/dataframe_util.py +18 -10
- streamlit/delta_generator.py +8 -7
- streamlit/delta_generator_singletons.py +3 -1
- streamlit/deprecation_util.py +17 -6
- streamlit/elements/arrow.py +90 -42
- streamlit/elements/deck_gl_json_chart.py +98 -39
- streamlit/elements/dialog_decorator.py +2 -1
- streamlit/elements/exception.py +3 -1
- streamlit/elements/form.py +6 -6
- streamlit/elements/graphviz_chart.py +24 -9
- streamlit/elements/heading.py +3 -5
- streamlit/elements/iframe.py +0 -2
- streamlit/elements/image.py +12 -13
- streamlit/elements/layouts.py +89 -22
- streamlit/elements/lib/built_in_chart_utils.py +95 -31
- streamlit/elements/lib/color_util.py +8 -18
- streamlit/elements/lib/column_config_utils.py +9 -8
- streamlit/elements/lib/column_types.py +595 -148
- streamlit/elements/lib/dialog.py +3 -2
- streamlit/elements/lib/image_utils.py +3 -5
- streamlit/elements/lib/layout_utils.py +50 -13
- streamlit/elements/lib/mutable_status_container.py +2 -2
- streamlit/elements/lib/options_selector_utils.py +2 -2
- streamlit/elements/lib/pandas_styler_utils.py +30 -14
- streamlit/elements/lib/utils.py +21 -9
- streamlit/elements/map.py +81 -40
- streamlit/elements/media.py +7 -7
- streamlit/elements/metric.py +11 -35
- streamlit/elements/pdf.py +2 -4
- streamlit/elements/plotly_chart.py +142 -26
- streamlit/elements/progress.py +2 -4
- streamlit/elements/pyplot.py +6 -6
- streamlit/elements/space.py +113 -0
- streamlit/elements/vega_charts.py +400 -143
- streamlit/elements/widgets/audio_input.py +52 -4
- streamlit/elements/widgets/button.py +29 -29
- streamlit/elements/widgets/button_group.py +33 -6
- streamlit/elements/widgets/camera_input.py +3 -4
- streamlit/elements/widgets/chat.py +7 -0
- streamlit/elements/widgets/checkbox.py +1 -0
- streamlit/elements/widgets/color_picker.py +1 -0
- streamlit/elements/widgets/data_editor.py +34 -29
- streamlit/elements/widgets/file_uploader.py +6 -10
- streamlit/elements/widgets/multiselect.py +14 -3
- streamlit/elements/widgets/number_input.py +5 -4
- streamlit/elements/widgets/radio.py +10 -2
- streamlit/elements/widgets/select_slider.py +8 -4
- streamlit/elements/widgets/selectbox.py +9 -2
- streamlit/elements/widgets/slider.py +38 -41
- streamlit/elements/widgets/text_widgets.py +6 -0
- streamlit/elements/widgets/time_widgets.py +15 -12
- streamlit/elements/write.py +28 -23
- streamlit/emojis.py +1 -1
- streamlit/errors.py +115 -0
- streamlit/git_util.py +65 -43
- streamlit/hello/hello.py +8 -0
- streamlit/hello/utils.py +2 -1
- streamlit/material_icon_names.py +1 -1
- streamlit/navigation/page.py +4 -1
- streamlit/proto/ArrowData_pb2.py +27 -0
- streamlit/proto/ArrowData_pb2.pyi +46 -0
- streamlit/proto/Arrow_pb2.py +10 -8
- streamlit/proto/Arrow_pb2.pyi +31 -2
- streamlit/proto/AudioInput_pb2.py +2 -2
- streamlit/proto/AudioInput_pb2.pyi +6 -2
- streamlit/proto/BidiComponent_pb2.py +34 -0
- streamlit/proto/BidiComponent_pb2.pyi +153 -0
- streamlit/proto/Block_pb2.py +11 -11
- streamlit/proto/Block_pb2.pyi +9 -1
- streamlit/proto/DeckGlJsonChart_pb2.py +10 -4
- streamlit/proto/DeckGlJsonChart_pb2.pyi +9 -3
- streamlit/proto/Element_pb2.py +5 -3
- streamlit/proto/Element_pb2.pyi +14 -4
- streamlit/proto/HeightConfig_pb2.py +2 -2
- streamlit/proto/HeightConfig_pb2.pyi +6 -3
- streamlit/proto/NewSession_pb2.py +18 -16
- streamlit/proto/NewSession_pb2.pyi +158 -6
- streamlit/proto/PlotlyChart_pb2.py +8 -6
- streamlit/proto/PlotlyChart_pb2.pyi +3 -1
- streamlit/proto/Space_pb2.py +27 -0
- streamlit/proto/Space_pb2.pyi +42 -0
- streamlit/proto/WidgetStates_pb2.py +2 -2
- streamlit/proto/WidgetStates_pb2.pyi +13 -3
- streamlit/proto/WidthConfig_pb2.py +2 -2
- streamlit/proto/WidthConfig_pb2.pyi +6 -3
- streamlit/runtime/app_session.py +45 -6
- streamlit/runtime/caching/cache_data_api.py +4 -4
- streamlit/runtime/caching/cache_errors.py +4 -1
- streamlit/runtime/caching/cache_resource_api.py +3 -2
- streamlit/runtime/caching/cache_utils.py +2 -1
- streamlit/runtime/caching/cached_message_replay.py +3 -3
- streamlit/runtime/caching/hashing.py +3 -4
- streamlit/runtime/caching/legacy_cache_api.py +2 -1
- streamlit/runtime/connection_factory.py +1 -3
- streamlit/runtime/forward_msg_queue.py +4 -1
- streamlit/runtime/fragment.py +2 -1
- streamlit/runtime/memory_media_file_storage.py +1 -1
- streamlit/runtime/metrics_util.py +6 -2
- streamlit/runtime/runtime.py +14 -0
- streamlit/runtime/scriptrunner/exec_code.py +2 -1
- streamlit/runtime/scriptrunner/script_runner.py +2 -2
- streamlit/runtime/scriptrunner_utils/script_run_context.py +3 -6
- streamlit/runtime/secrets.py +2 -4
- streamlit/runtime/session_manager.py +3 -1
- streamlit/runtime/state/common.py +30 -5
- streamlit/runtime/state/presentation.py +85 -0
- streamlit/runtime/state/safe_session_state.py +2 -2
- streamlit/runtime/state/session_state.py +220 -16
- streamlit/runtime/state/widgets.py +19 -3
- streamlit/runtime/theme_util.py +148 -0
- streamlit/runtime/websocket_session_manager.py +3 -1
- streamlit/source_util.py +2 -2
- streamlit/static/index.html +2 -2
- streamlit/static/manifest.json +244 -227
- streamlit/static/static/css/{index.C8X8rNzw.css → index.BpABIXK9.css} +1 -1
- streamlit/static/static/css/index.DgR7E2CV.css +1 -0
- streamlit/static/static/js/{ErrorOutline.esm.DcGrhbBP.js → ErrorOutline.esm.YoJdlW1p.js} +1 -1
- streamlit/static/static/js/{FileDownload.esm.DgBvV6Pq.js → FileDownload.esm.Ddx8VEYy.js} +1 -1
- streamlit/static/static/js/{FileHelper.M6AAaeuA.js → FileHelper.90EtOmj9.js} +1 -1
- streamlit/static/static/js/{FormClearHelper.DHh1GFzm.js → FormClearHelper.BB1Km6eP.js} +1 -1
- streamlit/static/static/js/InputInstructions.jhH15PqV.js +1 -0
- streamlit/static/static/js/{Particles.DDVT-6Qc.js → Particles.DUsputn1.js} +1 -1
- streamlit/static/static/js/{ProgressBar.BEY0cXXV.js → ProgressBar.DLY8H6nE.js} +2 -2
- streamlit/static/static/js/Toolbar.D8nHCkuz.js +1 -0
- streamlit/static/static/js/{base-input.CK3UVGp1.js → base-input.CJGiNqed.js} +3 -3
- streamlit/static/static/js/{checkbox.D8W881TL.js → checkbox.Cpdd482O.js} +1 -1
- streamlit/static/static/js/{createSuper.B6W-Dh9S.js → createSuper.CuQIogbW.js} +1 -1
- streamlit/static/static/js/data-grid-overlay-editor.2Ufgxc6y.js +1 -0
- streamlit/static/static/js/{downloader.DiKpuU_S.js → downloader.CN0K7xlu.js} +1 -1
- streamlit/static/static/js/{es6.B8zRNPZ-.js → es6.BJcsVXQ0.js} +2 -2
- streamlit/static/static/js/{iframeResizer.contentWindow.DIewJmmh.js → iframeResizer.contentWindow.XzUvQqcZ.js} +1 -1
- streamlit/static/static/js/index.B1ZQh4P1.js +1 -0
- streamlit/static/static/js/index.BKstZk0M.js +27 -0
- streamlit/static/static/js/{index.Bte_9Lyq.js → index.BMcFsUee.js} +1 -1
- streamlit/static/static/js/{index.qhs54UAB.js → index.BR-IdcTb.js} +1 -1
- streamlit/static/static/js/{index.CejBxbg1.js → index.B_dWA3vd.js} +1 -1
- streamlit/static/static/js/{index.D5naqx-J.js → index.BgnZEMVh.js} +1 -1
- streamlit/static/static/js/{index.C7fRKRs4.js → index.BohqXifI.js} +1 -1
- streamlit/static/static/js/{index.cnnXF7xQ.js → index.Br5nxKNj.js} +1 -1
- streamlit/static/static/js/index.BrIKVbNc.js +3 -0
- streamlit/static/static/js/index.BtWUPzle.js +1 -0
- streamlit/static/static/js/index.C0RLraek.js +1 -0
- streamlit/static/static/js/{index.CP5TD2z1.js → index.CAIjskgG.js} +1 -1
- streamlit/static/static/js/{index.CD8HuT3N.js → index.CAj-7vWz.js} +135 -162
- streamlit/static/static/js/{index.DtYN2x4k.js → index.CMtEit2O.js} +1 -1
- streamlit/static/static/js/index.CkRlykEE.js +12 -0
- streamlit/static/static/js/{index.Ts_0SdB9.js → index.CmN3FXfI.js} +2 -2
- streamlit/static/static/js/{index.BnEpvLEz.js → index.CwbFI1_-.js} +1 -1
- streamlit/static/static/js/{index.CcJf6BCU.js → index.CxIUUfab.js} +27 -27
- streamlit/static/static/js/index.D2KPNy7e.js +1 -0
- streamlit/static/static/js/{index.Ch7MBCx0.js → index.D3GPA5k4.js} +47 -47
- streamlit/static/static/js/{index.ho6NIXGl.js → index.DGAh7DMq.js} +1 -1
- streamlit/static/static/js/index.DKb_NvmG.js +197 -0
- streamlit/static/static/js/{index.CvYYtxD_.js → index.DMqgUYKq.js} +1 -1
- streamlit/static/static/js/{index.zecpGxtj.js → index.DOFlg3dS.js} +1 -1
- streamlit/static/static/js/{index.B9mjBcgE.js → index.DPUXkcQL.js} +1 -1
- streamlit/static/static/js/index.DX1xY89g.js +1 -0
- streamlit/static/static/js/index.DYATBCsq.js +2 -0
- streamlit/static/static/js/{index.D2-atlaQ.js → index.DaSmGJ76.js} +3 -3
- streamlit/static/static/js/index.Dd7bMeLP.js +1 -0
- streamlit/static/static/js/{index.4eF4NxG2.js → index.DjmmgI5U.js} +1 -1
- streamlit/static/static/js/index.Dq56CyM2.js +1 -0
- streamlit/static/static/js/index.DuiXaS5_.js +7 -0
- streamlit/static/static/js/index.DvFidMLe.js +2 -0
- streamlit/static/static/js/{index.452cqrrL.js → index.DwkhC5Pc.js} +1 -1
- streamlit/static/static/js/{index.Dk4C7X3i.js → index.Q-3sFn1v.js} +1 -1
- streamlit/static/static/js/{index.CjXWwH-y.js → index.QJ5QO9sJ.js} +1 -1
- streamlit/static/static/js/{index.B6U8LQo3.js → index.VwTaeety.js} +1 -1
- streamlit/static/static/js/index.YOqQbeX8.js +1 -0
- streamlit/static/static/js/{input.nzVJphXi.js → input.D4MN_FzN.js} +1 -1
- streamlit/static/static/js/{memory.CjCgTQz3.js → memory.DrZjtdGT.js} +1 -1
- streamlit/static/static/js/{number-overlay-editor.DaRFzZEO.js → number-overlay-editor.DRwAw1In.js} +1 -1
- streamlit/static/static/js/{possibleConstructorReturn.DgiPnZ9N.js → possibleConstructorReturn.exeeJQEP.js} +1 -1
- streamlit/static/static/js/record.B-tDciZb.js +1 -0
- streamlit/static/static/js/{sandbox.mithfq7Z.js → sandbox.ClO3IuUr.js} +1 -1
- streamlit/static/static/js/{timepicker.Dbl5KFh6.js → timepicker.DAhu-vcF.js} +4 -4
- streamlit/static/static/js/{toConsumableArray.D-Dx88BQ.js → toConsumableArray.DNbljYEC.js} +1 -1
- streamlit/static/static/js/{uniqueId.Bh26R_3S.js → uniqueId.oG4Gvj1v.js} +1 -1
- streamlit/static/static/js/{useBasicWidgetState.DeK-QJpD.js → useBasicWidgetState.D6sOH6oI.js} +1 -1
- streamlit/static/static/js/{useTextInputAutoExpand.4iAdLWD-.js → useTextInputAutoExpand.4u3_GcuN.js} +2 -2
- streamlit/static/static/js/{useUpdateUiValue.CmT7_nJN.js → useUpdateUiValue.F2R3eTeR.js} +1 -1
- streamlit/static/static/js/wavesurfer.esm.vI8Eid4k.js +73 -0
- streamlit/static/static/js/withFullScreenWrapper.zothJIsI.js +1 -0
- streamlit/static/static/media/MaterialSymbols-Rounded.C7IFxh57.woff2 +0 -0
- streamlit/string_util.py +56 -1
- streamlit/testing/v1/app_test.py +2 -2
- streamlit/testing/v1/element_tree.py +23 -9
- streamlit/testing/v1/util.py +2 -2
- streamlit/type_util.py +3 -4
- streamlit/url_util.py +1 -3
- streamlit/user_info.py +1 -2
- streamlit/util.py +3 -1
- streamlit/watcher/event_based_path_watcher.py +23 -12
- streamlit/watcher/local_sources_watcher.py +11 -1
- streamlit/watcher/path_watcher.py +9 -6
- streamlit/watcher/polling_path_watcher.py +4 -1
- streamlit/watcher/util.py +2 -2
- streamlit/web/bootstrap.py +0 -31
- streamlit/web/cli.py +51 -22
- streamlit/web/server/bidi_component_request_handler.py +193 -0
- streamlit/web/server/component_file_utils.py +97 -0
- streamlit/web/server/component_request_handler.py +8 -21
- streamlit/web/server/oidc_mixin.py +3 -1
- streamlit/web/server/routes.py +18 -5
- streamlit/web/server/server.py +10 -0
- streamlit/web/server/server_util.py +3 -1
- streamlit/web/server/upload_file_request_handler.py +3 -1
- {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/METADATA +4 -5
- {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/RECORD +238 -209
- streamlit/static/static/css/index.COe1010n.css +0 -1
- streamlit/static/static/js/Hooks.DGu1od_L.js +0 -1
- streamlit/static/static/js/InputInstructions.z6sVgyYt.js +0 -1
- streamlit/static/static/js/Toolbar.DSnK1fUh.js +0 -1
- streamlit/static/static/js/data-grid-overlay-editor.DRTHOydk.js +0 -1
- streamlit/static/static/js/index.BXYmrqnf.js +0 -1
- streamlit/static/static/js/index.B_8AnktO.js +0 -1
- streamlit/static/static/js/index.Bl7zGQSh.js +0 -7
- streamlit/static/static/js/index.BnJIOYn9.js +0 -73
- streamlit/static/static/js/index.C1HcTl5K.js +0 -1
- streamlit/static/static/js/index.C7lSmSOP.js +0 -1
- streamlit/static/static/js/index.C_tmcx4B.js +0 -1
- streamlit/static/static/js/index.D3K5nOu9.js +0 -197
- streamlit/static/static/js/index.DkKT3LUI.js +0 -1
- streamlit/static/static/js/index.MTPPBDHk.js +0 -2
- streamlit/static/static/js/index.pqW9AMJD.js +0 -3
- streamlit/static/static/js/index.urHgTgMQ.js +0 -12
- streamlit/static/static/js/index.wzkv_11M.js +0 -1
- streamlit/static/static/js/index.yF5AncHY.js +0 -1
- streamlit/static/static/js/withFullScreenWrapper.DLp1ENGm.js +0 -1
- streamlit/static/static/media/MaterialSymbols-Rounded.CBxVaFdk.woff2 +0 -0
- {streamlit-1.49.1.data → streamlit-1.51.0.data}/scripts/streamlit.cmd +0 -0
- {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/WHEEL +0 -0
- {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/entry_points.txt +0 -0
- {streamlit-1.49.1.dist-info → streamlit-1.51.0.dist-info}/top_level.txt +0 -0
|
@@ -18,15 +18,18 @@
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
20
|
import datetime
|
|
21
|
-
|
|
21
|
+
import itertools
|
|
22
|
+
from typing import TYPE_CHECKING, Literal, TypeAlias, TypedDict
|
|
22
23
|
|
|
23
|
-
from typing_extensions import NotRequired
|
|
24
|
+
from typing_extensions import NotRequired
|
|
24
25
|
|
|
26
|
+
from streamlit.elements.lib.color_util import is_css_color_like
|
|
27
|
+
from streamlit.errors import StreamlitValueError
|
|
25
28
|
from streamlit.runtime.metrics_util import gather_metrics
|
|
26
29
|
from streamlit.string_util import validate_material_icon
|
|
27
30
|
|
|
28
31
|
if TYPE_CHECKING:
|
|
29
|
-
from collections.abc import Iterable
|
|
32
|
+
from collections.abc import Callable, Iterable, Iterator
|
|
30
33
|
|
|
31
34
|
NumberFormat: TypeAlias = Literal[
|
|
32
35
|
"plain",
|
|
@@ -42,7 +45,7 @@ NumberFormat: TypeAlias = Literal[
|
|
|
42
45
|
"bytes",
|
|
43
46
|
]
|
|
44
47
|
|
|
45
|
-
ColumnWidth: TypeAlias =
|
|
48
|
+
ColumnWidth: TypeAlias = Literal["small", "medium", "large"] | int
|
|
46
49
|
|
|
47
50
|
# Type alias that represents all available column types
|
|
48
51
|
# which are configurable by the user.
|
|
@@ -62,9 +65,53 @@ ColumnType: TypeAlias = Literal[
|
|
|
62
65
|
"area_chart",
|
|
63
66
|
"image",
|
|
64
67
|
"progress",
|
|
68
|
+
"multiselect",
|
|
65
69
|
"json",
|
|
66
70
|
]
|
|
67
71
|
|
|
72
|
+
# Themeable colors supported in the theme config:
|
|
73
|
+
ThemeColor: TypeAlias = Literal[
|
|
74
|
+
"red",
|
|
75
|
+
"blue",
|
|
76
|
+
"green",
|
|
77
|
+
"yellow",
|
|
78
|
+
"orange",
|
|
79
|
+
"violet",
|
|
80
|
+
"gray",
|
|
81
|
+
"grey",
|
|
82
|
+
"primary",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
# Color options for chart columns:
|
|
86
|
+
ChartColor: TypeAlias = Literal["auto", "auto-inverse"] | ThemeColor | str
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _validate_chart_color(maybe_color: str) -> None:
|
|
90
|
+
"""Validate a color for a chart column."""
|
|
91
|
+
|
|
92
|
+
supported_colors = [
|
|
93
|
+
"auto",
|
|
94
|
+
"auto-inverse",
|
|
95
|
+
"red",
|
|
96
|
+
"blue",
|
|
97
|
+
"green",
|
|
98
|
+
"yellow",
|
|
99
|
+
"violet",
|
|
100
|
+
"orange",
|
|
101
|
+
"gray",
|
|
102
|
+
"grey",
|
|
103
|
+
"primary",
|
|
104
|
+
]
|
|
105
|
+
if maybe_color not in supported_colors and not is_css_color_like(maybe_color):
|
|
106
|
+
raise StreamlitValueError(
|
|
107
|
+
"color",
|
|
108
|
+
[
|
|
109
|
+
*supported_colors,
|
|
110
|
+
"a valid hex color",
|
|
111
|
+
"an rgb() or rgba() color",
|
|
112
|
+
],
|
|
113
|
+
)
|
|
114
|
+
|
|
68
115
|
|
|
69
116
|
class NumberColumnConfig(TypedDict):
|
|
70
117
|
type: Literal["number"]
|
|
@@ -84,7 +131,7 @@ class CheckboxColumnConfig(TypedDict):
|
|
|
84
131
|
type: Literal["checkbox"]
|
|
85
132
|
|
|
86
133
|
|
|
87
|
-
SelectboxOptionValue: TypeAlias =
|
|
134
|
+
SelectboxOptionValue: TypeAlias = str | int | float | bool
|
|
88
135
|
|
|
89
136
|
|
|
90
137
|
class SelectboxOption(TypedDict):
|
|
@@ -108,18 +155,21 @@ class BarChartColumnConfig(TypedDict):
|
|
|
108
155
|
type: Literal["bar_chart"]
|
|
109
156
|
y_min: NotRequired[int | float | None]
|
|
110
157
|
y_max: NotRequired[int | float | None]
|
|
158
|
+
color: NotRequired[ChartColor | None]
|
|
111
159
|
|
|
112
160
|
|
|
113
161
|
class LineChartColumnConfig(TypedDict):
|
|
114
162
|
type: Literal["line_chart"]
|
|
115
163
|
y_min: NotRequired[int | float | None]
|
|
116
164
|
y_max: NotRequired[int | float | None]
|
|
165
|
+
color: NotRequired[ChartColor | None]
|
|
117
166
|
|
|
118
167
|
|
|
119
168
|
class AreaChartColumnConfig(TypedDict):
|
|
120
169
|
type: Literal["area_chart"]
|
|
121
170
|
y_min: NotRequired[int | float | None]
|
|
122
171
|
y_max: NotRequired[int | float | None]
|
|
172
|
+
color: NotRequired[ChartColor | None]
|
|
123
173
|
|
|
124
174
|
|
|
125
175
|
class ImageColumnConfig(TypedDict):
|
|
@@ -130,6 +180,18 @@ class ListColumnConfig(TypedDict):
|
|
|
130
180
|
type: Literal["list"]
|
|
131
181
|
|
|
132
182
|
|
|
183
|
+
class MultiselectOption(TypedDict):
|
|
184
|
+
value: str
|
|
185
|
+
label: NotRequired[str | None]
|
|
186
|
+
color: NotRequired[str | Literal["auto"] | ThemeColor | None]
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class MultiselectColumnConfig(TypedDict):
|
|
190
|
+
type: Literal["multiselect"]
|
|
191
|
+
options: NotRequired[Iterable[MultiselectOption | str] | None]
|
|
192
|
+
accept_new_options: NotRequired[bool | None]
|
|
193
|
+
|
|
194
|
+
|
|
133
195
|
class DatetimeColumnConfig(TypedDict):
|
|
134
196
|
type: Literal["datetime"]
|
|
135
197
|
format: NotRequired[
|
|
@@ -163,6 +225,7 @@ class ProgressColumnConfig(TypedDict):
|
|
|
163
225
|
min_value: NotRequired[int | float | None]
|
|
164
226
|
max_value: NotRequired[int | float | None]
|
|
165
227
|
step: NotRequired[int | float | None]
|
|
228
|
+
color: NotRequired[ChartColor | None]
|
|
166
229
|
|
|
167
230
|
|
|
168
231
|
class JsonColumnConfig(TypedDict):
|
|
@@ -174,11 +237,11 @@ class ColumnConfig(TypedDict, total=False):
|
|
|
174
237
|
|
|
175
238
|
Parameters
|
|
176
239
|
----------
|
|
177
|
-
label: str or None
|
|
240
|
+
label : str or None
|
|
178
241
|
The label shown at the top of the column. If this is ``None``
|
|
179
242
|
(default), the column name is used.
|
|
180
243
|
|
|
181
|
-
width: "small", "medium", "large", int, or None
|
|
244
|
+
width : "small", "medium", "large", int, or None
|
|
182
245
|
The display width of the column. If this is ``None`` (default), the
|
|
183
246
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
184
247
|
one of the following:
|
|
@@ -188,7 +251,11 @@ class ColumnConfig(TypedDict, total=False):
|
|
|
188
251
|
- ``"large"``: 400px wide
|
|
189
252
|
- An integer specifying the width in pixels
|
|
190
253
|
|
|
191
|
-
|
|
254
|
+
If the total width of all columns is less than the width of the
|
|
255
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
256
|
+
columns.
|
|
257
|
+
|
|
258
|
+
help : str or None
|
|
192
259
|
A tooltip that gets displayed when hovering over the column label. If
|
|
193
260
|
this is ``None`` (default), no tooltip is displayed.
|
|
194
261
|
|
|
@@ -196,34 +263,34 @@ class ColumnConfig(TypedDict, total=False):
|
|
|
196
263
|
the Markdown directives described in the ``body`` parameter of
|
|
197
264
|
``st.markdown``.
|
|
198
265
|
|
|
199
|
-
disabled: bool or None
|
|
266
|
+
disabled : bool or None
|
|
200
267
|
Whether editing should be disabled for this column. If this is ``None``
|
|
201
268
|
(default), Streamlit will enable editing wherever possible.
|
|
202
269
|
|
|
203
270
|
If a column has mixed types, it may become uneditable regardless of
|
|
204
271
|
``disabled``.
|
|
205
272
|
|
|
206
|
-
required: bool or None
|
|
273
|
+
required : bool or None
|
|
207
274
|
Whether edited cells in the column need to have a value. If this is
|
|
208
275
|
``False`` (default), the user can submit empty values for this column.
|
|
209
276
|
If this is ``True``, an edited cell in this column can only be
|
|
210
277
|
submitted if its value is not ``None``, and a new row will only be
|
|
211
278
|
submitted after the user fills in this column.
|
|
212
279
|
|
|
213
|
-
pinned: bool or None
|
|
280
|
+
pinned : bool or None
|
|
214
281
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
215
282
|
left side no matter where the user scrolls. If this is ``None``
|
|
216
283
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
217
284
|
columns are not pinned.
|
|
218
285
|
|
|
219
|
-
default: str, bool, int, float, or None
|
|
286
|
+
default : str, bool, int, float, or None
|
|
220
287
|
Specifies the default value in this column when a new row is added by
|
|
221
288
|
the user. This defaults to ``None``.
|
|
222
289
|
|
|
223
|
-
hidden: bool or None
|
|
290
|
+
hidden : bool or None
|
|
224
291
|
Whether to hide the column. This defaults to ``False``.
|
|
225
292
|
|
|
226
|
-
type_config: dict or str or None
|
|
293
|
+
type_config : dict or str or None
|
|
227
294
|
Configure a column type and type specific options.
|
|
228
295
|
"""
|
|
229
296
|
|
|
@@ -251,6 +318,7 @@ class ColumnConfig(TypedDict, total=False):
|
|
|
251
318
|
| BarChartColumnConfig
|
|
252
319
|
| AreaChartColumnConfig
|
|
253
320
|
| ImageColumnConfig
|
|
321
|
+
| MultiselectColumnConfig
|
|
254
322
|
| JsonColumnConfig
|
|
255
323
|
| None
|
|
256
324
|
)
|
|
@@ -278,11 +346,11 @@ def Column(
|
|
|
278
346
|
|
|
279
347
|
Parameters
|
|
280
348
|
----------
|
|
281
|
-
label: str or None
|
|
349
|
+
label : str or None
|
|
282
350
|
The label shown at the top of the column. If this is ``None``
|
|
283
351
|
(default), the column name is used.
|
|
284
352
|
|
|
285
|
-
width: "small", "medium", "large", int, or None
|
|
353
|
+
width : "small", "medium", "large", int, or None
|
|
286
354
|
The display width of the column. If this is ``None`` (default), the
|
|
287
355
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
288
356
|
one of the following:
|
|
@@ -292,7 +360,11 @@ def Column(
|
|
|
292
360
|
- ``"large"``: 400px wide
|
|
293
361
|
- An integer specifying the width in pixels
|
|
294
362
|
|
|
295
|
-
|
|
363
|
+
If the total width of all columns is less than the width of the
|
|
364
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
365
|
+
columns.
|
|
366
|
+
|
|
367
|
+
help : str or None
|
|
296
368
|
A tooltip that gets displayed when hovering over the column label. If
|
|
297
369
|
this is ``None`` (default), no tooltip is displayed.
|
|
298
370
|
|
|
@@ -300,21 +372,21 @@ def Column(
|
|
|
300
372
|
the Markdown directives described in the ``body`` parameter of
|
|
301
373
|
``st.markdown``.
|
|
302
374
|
|
|
303
|
-
disabled: bool or None
|
|
375
|
+
disabled : bool or None
|
|
304
376
|
Whether editing should be disabled for this column. If this is ``None``
|
|
305
377
|
(default), Streamlit will enable editing wherever possible.
|
|
306
378
|
|
|
307
379
|
If a column has mixed types, it may become uneditable regardless of
|
|
308
380
|
``disabled``.
|
|
309
381
|
|
|
310
|
-
required: bool or None
|
|
382
|
+
required : bool or None
|
|
311
383
|
Whether edited cells in the column need to have a value. If this is
|
|
312
384
|
``False`` (default), the user can submit empty values for this column.
|
|
313
385
|
If this is ``True``, an edited cell in this column can only be
|
|
314
386
|
submitted if its value is not ``None``, and a new row will only be
|
|
315
387
|
submitted after the user fills in this column.
|
|
316
388
|
|
|
317
|
-
pinned: bool or None
|
|
389
|
+
pinned : bool or None
|
|
318
390
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
319
391
|
left side no matter where the user scrolls. If this is ``None``
|
|
320
392
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
@@ -382,11 +454,11 @@ def NumberColumn(
|
|
|
382
454
|
|
|
383
455
|
Parameters
|
|
384
456
|
----------
|
|
385
|
-
label: str or None
|
|
457
|
+
label : str or None
|
|
386
458
|
The label shown at the top of the column. If this is ``None``
|
|
387
459
|
(default), the column name is used.
|
|
388
460
|
|
|
389
|
-
width: "small", "medium", "large", int, or None
|
|
461
|
+
width : "small", "medium", "large", int, or None
|
|
390
462
|
The display width of the column. If this is ``None`` (default), the
|
|
391
463
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
392
464
|
one of the following:
|
|
@@ -396,7 +468,11 @@ def NumberColumn(
|
|
|
396
468
|
- ``"large"``: 400px wide
|
|
397
469
|
- An integer specifying the width in pixels
|
|
398
470
|
|
|
399
|
-
|
|
471
|
+
If the total width of all columns is less than the width of the
|
|
472
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
473
|
+
columns.
|
|
474
|
+
|
|
475
|
+
help : str or None
|
|
400
476
|
A tooltip that gets displayed when hovering over the column label. If
|
|
401
477
|
this is ``None`` (default), no tooltip is displayed.
|
|
402
478
|
|
|
@@ -404,31 +480,31 @@ def NumberColumn(
|
|
|
404
480
|
the Markdown directives described in the ``body`` parameter of
|
|
405
481
|
``st.markdown``.
|
|
406
482
|
|
|
407
|
-
disabled: bool or None
|
|
483
|
+
disabled : bool or None
|
|
408
484
|
Whether editing should be disabled for this column. If this is ``None``
|
|
409
485
|
(default), Streamlit will enable editing wherever possible.
|
|
410
486
|
|
|
411
487
|
If a column has mixed types, it may become uneditable regardless of
|
|
412
488
|
``disabled``.
|
|
413
489
|
|
|
414
|
-
required: bool or None
|
|
490
|
+
required : bool or None
|
|
415
491
|
Whether edited cells in the column need to have a value. If this is
|
|
416
492
|
``False`` (default), the user can submit empty values for this column.
|
|
417
493
|
If this is ``True``, an edited cell in this column can only be
|
|
418
494
|
submitted if its value is not ``None``, and a new row will only be
|
|
419
495
|
submitted after the user fills in this column.
|
|
420
496
|
|
|
421
|
-
pinned: bool or None
|
|
497
|
+
pinned : bool or None
|
|
422
498
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
423
499
|
left side no matter where the user scrolls. If this is ``None``
|
|
424
500
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
425
501
|
columns are not pinned.
|
|
426
502
|
|
|
427
|
-
default: int, float, or None
|
|
503
|
+
default : int, float, or None
|
|
428
504
|
Specifies the default value in this column when a new row is added by
|
|
429
505
|
the user. This defaults to ``None``.
|
|
430
506
|
|
|
431
|
-
format: str, "plain", "localized", "percent", "dollar", "euro", "yen", "accounting", "compact", "scientific", "engineering", or None
|
|
507
|
+
format : str, "plain", "localized", "percent", "dollar", "euro", "yen", "accounting", "compact", "scientific", "engineering", or None
|
|
432
508
|
A format string controlling how numbers are displayed.
|
|
433
509
|
This can be one of the following values:
|
|
434
510
|
|
|
@@ -455,15 +531,15 @@ def NumberColumn(
|
|
|
455
531
|
formatting from ``pandas.Styler``. The formatting does not impact the
|
|
456
532
|
return value when used in ``st.data_editor``.
|
|
457
533
|
|
|
458
|
-
min_value: int, float, or None
|
|
534
|
+
min_value : int, float, or None
|
|
459
535
|
The minimum value that can be entered. If this is ``None`` (default),
|
|
460
536
|
there will be no minimum.
|
|
461
537
|
|
|
462
|
-
max_value: int, float, or None
|
|
538
|
+
max_value : int, float, or None
|
|
463
539
|
The maximum value that can be entered. If this is ``None`` (default),
|
|
464
540
|
there will be no maximum.
|
|
465
541
|
|
|
466
|
-
step: int, float, or None
|
|
542
|
+
step : int, float, or None
|
|
467
543
|
The precision of numbers that can be entered. If this ``None``
|
|
468
544
|
(default), integer columns will have a step of 1 and float columns will
|
|
469
545
|
have unrestricted precision. In this case, some floats may display like
|
|
@@ -544,11 +620,11 @@ def TextColumn(
|
|
|
544
620
|
|
|
545
621
|
Parameters
|
|
546
622
|
----------
|
|
547
|
-
label: str or None
|
|
623
|
+
label : str or None
|
|
548
624
|
The label shown at the top of the column. If this is ``None``
|
|
549
625
|
(default), the column name is used.
|
|
550
626
|
|
|
551
|
-
width: "small", "medium", "large", int, or None
|
|
627
|
+
width : "small", "medium", "large", int, or None
|
|
552
628
|
The display width of the column. If this is ``None`` (default), the
|
|
553
629
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
554
630
|
one of the following:
|
|
@@ -558,7 +634,11 @@ def TextColumn(
|
|
|
558
634
|
- ``"large"``: 400px wide
|
|
559
635
|
- An integer specifying the width in pixels
|
|
560
636
|
|
|
561
|
-
|
|
637
|
+
If the total width of all columns is less than the width of the
|
|
638
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
639
|
+
columns.
|
|
640
|
+
|
|
641
|
+
help : str or None
|
|
562
642
|
A tooltip that gets displayed when hovering over the column label. If
|
|
563
643
|
this is ``None`` (default), no tooltip is displayed.
|
|
564
644
|
|
|
@@ -566,35 +646,35 @@ def TextColumn(
|
|
|
566
646
|
the Markdown directives described in the ``body`` parameter of
|
|
567
647
|
``st.markdown``.
|
|
568
648
|
|
|
569
|
-
disabled: bool or None
|
|
649
|
+
disabled : bool or None
|
|
570
650
|
Whether editing should be disabled for this column. If this is ``None``
|
|
571
651
|
(default), Streamlit will enable editing wherever possible.
|
|
572
652
|
|
|
573
653
|
If a column has mixed types, it may become uneditable regardless of
|
|
574
654
|
``disabled``.
|
|
575
655
|
|
|
576
|
-
required: bool or None
|
|
656
|
+
required : bool or None
|
|
577
657
|
Whether edited cells in the column need to have a value. If this is
|
|
578
658
|
``False`` (default), the user can submit empty values for this column.
|
|
579
659
|
If this is ``True``, an edited cell in this column can only be
|
|
580
660
|
submitted if its value is not ``None``, and a new row will only be
|
|
581
661
|
submitted after the user fills in this column.
|
|
582
662
|
|
|
583
|
-
pinned: bool or None
|
|
663
|
+
pinned : bool or None
|
|
584
664
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
585
665
|
left side no matter where the user scrolls. If this is ``None``
|
|
586
666
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
587
667
|
columns are not pinned.
|
|
588
668
|
|
|
589
|
-
default: str or None
|
|
669
|
+
default : str or None
|
|
590
670
|
Specifies the default value in this column when a new row is added by
|
|
591
671
|
the user. This defaults to ``None``.
|
|
592
672
|
|
|
593
|
-
max_chars: int or None
|
|
673
|
+
max_chars : int or None
|
|
594
674
|
The maximum number of characters that can be entered. If this is
|
|
595
675
|
``None`` (default), there will be no maximum.
|
|
596
676
|
|
|
597
|
-
validate: str or None
|
|
677
|
+
validate : str or None
|
|
598
678
|
A JS-flavored regular expression (e.g. ``"^[a-z]+$"``) that edited
|
|
599
679
|
values are validated against. If the user input is invalid, it will not
|
|
600
680
|
be submitted.
|
|
@@ -666,11 +746,11 @@ def LinkColumn(
|
|
|
666
746
|
|
|
667
747
|
Parameters
|
|
668
748
|
----------
|
|
669
|
-
label: str or None
|
|
749
|
+
label : str or None
|
|
670
750
|
The label shown at the top of the column. If this is ``None``
|
|
671
751
|
(default), the column name is used.
|
|
672
752
|
|
|
673
|
-
width: "small", "medium", "large", int, or None
|
|
753
|
+
width : "small", "medium", "large", int, or None
|
|
674
754
|
The display width of the column. If this is ``None`` (default), the
|
|
675
755
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
676
756
|
one of the following:
|
|
@@ -680,7 +760,11 @@ def LinkColumn(
|
|
|
680
760
|
- ``"large"``: 400px wide
|
|
681
761
|
- An integer specifying the width in pixels
|
|
682
762
|
|
|
683
|
-
|
|
763
|
+
If the total width of all columns is less than the width of the
|
|
764
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
765
|
+
columns.
|
|
766
|
+
|
|
767
|
+
help : str or None
|
|
684
768
|
A tooltip that gets displayed when hovering over the column label. If
|
|
685
769
|
this is ``None`` (default), no tooltip is displayed.
|
|
686
770
|
|
|
@@ -688,40 +772,40 @@ def LinkColumn(
|
|
|
688
772
|
the Markdown directives described in the ``body`` parameter of
|
|
689
773
|
``st.markdown``.
|
|
690
774
|
|
|
691
|
-
disabled: bool or None
|
|
775
|
+
disabled : bool or None
|
|
692
776
|
Whether editing should be disabled for this column. If this is ``None``
|
|
693
777
|
(default), Streamlit will enable editing wherever possible.
|
|
694
778
|
|
|
695
779
|
If a column has mixed types, it may become uneditable regardless of
|
|
696
780
|
``disabled``.
|
|
697
781
|
|
|
698
|
-
required: bool or None
|
|
782
|
+
required : bool or None
|
|
699
783
|
Whether edited cells in the column need to have a value. If this is
|
|
700
784
|
``False`` (default), the user can submit empty values for this column.
|
|
701
785
|
If this is ``True``, an edited cell in this column can only be
|
|
702
786
|
submitted if its value is not ``None``, and a new row will only be
|
|
703
787
|
submitted after the user fills in this column.
|
|
704
788
|
|
|
705
|
-
pinned: bool or None
|
|
789
|
+
pinned : bool or None
|
|
706
790
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
707
791
|
left side no matter where the user scrolls. If this is ``None``
|
|
708
792
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
709
793
|
columns are not pinned.
|
|
710
794
|
|
|
711
|
-
default: str or None
|
|
795
|
+
default : str or None
|
|
712
796
|
Specifies the default value in this column when a new row is added by
|
|
713
797
|
the user. This defaults to ``None``.
|
|
714
798
|
|
|
715
|
-
max_chars: int or None
|
|
799
|
+
max_chars : int or None
|
|
716
800
|
The maximum number of characters that can be entered. If this is
|
|
717
801
|
``None`` (default), there will be no maximum.
|
|
718
802
|
|
|
719
|
-
validate: str or None
|
|
803
|
+
validate : str or None
|
|
720
804
|
A JS-flavored regular expression (e.g. ``"^https://.+$"``) that edited
|
|
721
805
|
values are validated against. If the user input is invalid, it will not
|
|
722
806
|
be submitted.
|
|
723
807
|
|
|
724
|
-
display_text: str or None
|
|
808
|
+
display_text : str or None
|
|
725
809
|
The text that is displayed in the cell. This can be one of the
|
|
726
810
|
following:
|
|
727
811
|
|
|
@@ -824,11 +908,11 @@ def CheckboxColumn(
|
|
|
824
908
|
|
|
825
909
|
Parameters
|
|
826
910
|
----------
|
|
827
|
-
label: str or None
|
|
911
|
+
label : str or None
|
|
828
912
|
The label shown at the top of the column. If this is ``None``
|
|
829
913
|
(default), the column name is used.
|
|
830
914
|
|
|
831
|
-
width: "small", "medium", "large", int, or None
|
|
915
|
+
width : "small", "medium", "large", int, or None
|
|
832
916
|
The display width of the column. If this is ``None`` (default), the
|
|
833
917
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
834
918
|
one of the following:
|
|
@@ -838,7 +922,11 @@ def CheckboxColumn(
|
|
|
838
922
|
- ``"large"``: 400px wide
|
|
839
923
|
- An integer specifying the width in pixels
|
|
840
924
|
|
|
841
|
-
|
|
925
|
+
If the total width of all columns is less than the width of the
|
|
926
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
927
|
+
columns.
|
|
928
|
+
|
|
929
|
+
help : str or None
|
|
842
930
|
A tooltip that gets displayed when hovering over the column label. If
|
|
843
931
|
this is ``None`` (default), no tooltip is displayed.
|
|
844
932
|
|
|
@@ -846,27 +934,27 @@ def CheckboxColumn(
|
|
|
846
934
|
the Markdown directives described in the ``body`` parameter of
|
|
847
935
|
``st.markdown``.
|
|
848
936
|
|
|
849
|
-
disabled: bool or None
|
|
937
|
+
disabled : bool or None
|
|
850
938
|
Whether editing should be disabled for this column. If this is ``None``
|
|
851
939
|
(default), Streamlit will enable editing wherever possible.
|
|
852
940
|
|
|
853
941
|
If a column has mixed types, it may become uneditable regardless of
|
|
854
942
|
``disabled``.
|
|
855
943
|
|
|
856
|
-
required: bool or None
|
|
944
|
+
required : bool or None
|
|
857
945
|
Whether edited cells in the column need to have a value. If this is
|
|
858
946
|
``False`` (default), the user can submit empty values for this column.
|
|
859
947
|
If this is ``True``, an edited cell in this column can only be
|
|
860
948
|
submitted if its value is not ``None``, and a new row will only be
|
|
861
949
|
submitted after the user fills in this column.
|
|
862
950
|
|
|
863
|
-
pinned: bool or None
|
|
951
|
+
pinned : bool or None
|
|
864
952
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
865
953
|
left side no matter where the user scrolls. If this is ``None``
|
|
866
954
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
867
955
|
columns are not pinned.
|
|
868
956
|
|
|
869
|
-
default: bool or None
|
|
957
|
+
default : bool or None
|
|
870
958
|
Specifies the default value in this column when a new row is added by
|
|
871
959
|
the user. This defaults to ``None``.
|
|
872
960
|
|
|
@@ -933,11 +1021,11 @@ def SelectboxColumn(
|
|
|
933
1021
|
|
|
934
1022
|
Parameters
|
|
935
1023
|
----------
|
|
936
|
-
label: str or None
|
|
1024
|
+
label : str or None
|
|
937
1025
|
The label shown at the top of the column. If this is ``None``
|
|
938
1026
|
(default), the column name is used.
|
|
939
1027
|
|
|
940
|
-
width: "small", "medium", "large", int, or None
|
|
1028
|
+
width : "small", "medium", "large", int, or None
|
|
941
1029
|
The display width of the column. If this is ``None`` (default), the
|
|
942
1030
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
943
1031
|
one of the following:
|
|
@@ -947,7 +1035,11 @@ def SelectboxColumn(
|
|
|
947
1035
|
- ``"large"``: 400px wide
|
|
948
1036
|
- An integer specifying the width in pixels
|
|
949
1037
|
|
|
950
|
-
|
|
1038
|
+
If the total width of all columns is less than the width of the
|
|
1039
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1040
|
+
columns.
|
|
1041
|
+
|
|
1042
|
+
help : str or None
|
|
951
1043
|
A tooltip that gets displayed when hovering over the column label. If
|
|
952
1044
|
this is ``None`` (default), no tooltip is displayed.
|
|
953
1045
|
|
|
@@ -955,43 +1047,42 @@ def SelectboxColumn(
|
|
|
955
1047
|
the Markdown directives described in the ``body`` parameter of
|
|
956
1048
|
``st.markdown``.
|
|
957
1049
|
|
|
958
|
-
disabled: bool or None
|
|
1050
|
+
disabled : bool or None
|
|
959
1051
|
Whether editing should be disabled for this column. If this is ``None``
|
|
960
1052
|
(default), Streamlit will enable editing wherever possible.
|
|
961
1053
|
|
|
962
1054
|
If a column has mixed types, it may become uneditable regardless of
|
|
963
1055
|
``disabled``.
|
|
964
1056
|
|
|
965
|
-
required: bool or None
|
|
1057
|
+
required : bool or None
|
|
966
1058
|
Whether edited cells in the column need to have a value. If this is
|
|
967
1059
|
``False`` (default), the user can submit empty values for this column.
|
|
968
1060
|
If this is ``True``, an edited cell in this column can only be
|
|
969
1061
|
submitted if its value is not ``None``, and a new row will only be
|
|
970
1062
|
submitted after the user fills in this column.
|
|
971
1063
|
|
|
972
|
-
pinned: bool or None
|
|
1064
|
+
pinned : bool or None
|
|
973
1065
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
974
1066
|
left side no matter where the user scrolls. If this is ``None``
|
|
975
1067
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
976
1068
|
columns are not pinned.
|
|
977
1069
|
|
|
978
|
-
default: str, int, float, bool, or None
|
|
1070
|
+
default : str, int, float, bool, or None
|
|
979
1071
|
Specifies the default value in this column when a new row is added by
|
|
980
1072
|
the user. This defaults to ``None``.
|
|
981
1073
|
|
|
982
|
-
options: Iterable[str, int, float, bool] or None
|
|
1074
|
+
options : Iterable[str, int, float, bool] or None
|
|
983
1075
|
The options that can be selected during editing. If this is ``None``
|
|
984
1076
|
(default), the options will be inferred from the underlying dataframe
|
|
985
1077
|
column if its dtype is "category". For more information, see `Pandas docs
|
|
986
1078
|
<https://pandas.pydata.org/docs/user_guide/categorical.html>`_).
|
|
987
1079
|
|
|
988
|
-
format_func: function or None
|
|
1080
|
+
format_func : function or None
|
|
989
1081
|
Function to modify the display of the options. It receives
|
|
990
1082
|
the raw option defined in ``options`` as an argument and should output
|
|
991
1083
|
the label to be shown for that option. If this is ``None`` (default),
|
|
992
1084
|
the raw option is used as the label.
|
|
993
1085
|
|
|
994
|
-
|
|
995
1086
|
Examples
|
|
996
1087
|
--------
|
|
997
1088
|
>>> import pandas as pd
|
|
@@ -1064,6 +1155,7 @@ def BarChartColumn(
|
|
|
1064
1155
|
pinned: bool | None = None,
|
|
1065
1156
|
y_min: int | float | None = None,
|
|
1066
1157
|
y_max: int | float | None = None,
|
|
1158
|
+
color: ChartColor | None = None,
|
|
1067
1159
|
) -> ColumnConfig:
|
|
1068
1160
|
"""Configure a bar chart column in ``st.dataframe`` or ``st.data_editor``.
|
|
1069
1161
|
|
|
@@ -1073,11 +1165,11 @@ def BarChartColumn(
|
|
|
1073
1165
|
|
|
1074
1166
|
Parameters
|
|
1075
1167
|
----------
|
|
1076
|
-
label: str or None
|
|
1168
|
+
label : str or None
|
|
1077
1169
|
The label shown at the top of the column. If this is ``None``
|
|
1078
1170
|
(default), the column name is used.
|
|
1079
1171
|
|
|
1080
|
-
width: "small", "medium", "large", int, or None
|
|
1172
|
+
width : "small", "medium", "large", int, or None
|
|
1081
1173
|
The display width of the column. If this is ``None`` (default), the
|
|
1082
1174
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1083
1175
|
one of the following:
|
|
@@ -1087,7 +1179,11 @@ def BarChartColumn(
|
|
|
1087
1179
|
- ``"large"``: 400px wide
|
|
1088
1180
|
- An integer specifying the width in pixels
|
|
1089
1181
|
|
|
1090
|
-
|
|
1182
|
+
If the total width of all columns is less than the width of the
|
|
1183
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1184
|
+
columns.
|
|
1185
|
+
|
|
1186
|
+
help : str or None
|
|
1091
1187
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1092
1188
|
this is ``None`` (default), no tooltip is displayed.
|
|
1093
1189
|
|
|
@@ -1101,14 +1197,27 @@ def BarChartColumn(
|
|
|
1101
1197
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1102
1198
|
columns are not pinned.
|
|
1103
1199
|
|
|
1104
|
-
y_min: int, float, or None
|
|
1200
|
+
y_min : int, float, or None
|
|
1105
1201
|
The minimum value on the y-axis for all cells in the column. If this is
|
|
1106
1202
|
``None`` (default), every cell will use the minimum of its data.
|
|
1107
1203
|
|
|
1108
|
-
y_max: int, float, or None
|
|
1204
|
+
y_max : int, float, or None
|
|
1109
1205
|
The maximum value on the y-axis for all cells in the column. If this is
|
|
1110
1206
|
``None`` (default), every cell will use the maximum of its data.
|
|
1111
1207
|
|
|
1208
|
+
color : "auto", "auto-inverse", str, or None
|
|
1209
|
+
The color to use for the chart. This can be one of the following:
|
|
1210
|
+
|
|
1211
|
+
- ``None`` (default): The primary color is used.
|
|
1212
|
+
- ``"auto"``: If the data is increasing, the chart is green; if the
|
|
1213
|
+
data is decreasing, the chart is red.
|
|
1214
|
+
- ``"auto-inverse"``: If the data is increasing, the chart is red; if
|
|
1215
|
+
the data is decreasing, the chart is green.
|
|
1216
|
+
- A single color value that is applied to all charts in the column.
|
|
1217
|
+
In addition to the basic color palette (red, orange, yellow, green,
|
|
1218
|
+
blue, violet, gray/grey, and primary), this supports hex codes like
|
|
1219
|
+
``"#483d8b"``.
|
|
1220
|
+
|
|
1112
1221
|
Examples
|
|
1113
1222
|
--------
|
|
1114
1223
|
>>> import pandas as pd
|
|
@@ -1143,12 +1252,17 @@ def BarChartColumn(
|
|
|
1143
1252
|
height: 300px
|
|
1144
1253
|
"""
|
|
1145
1254
|
|
|
1255
|
+
if color is not None:
|
|
1256
|
+
_validate_chart_color(color)
|
|
1257
|
+
|
|
1146
1258
|
return ColumnConfig(
|
|
1147
1259
|
label=label,
|
|
1148
1260
|
width=width,
|
|
1149
1261
|
help=help,
|
|
1150
1262
|
pinned=pinned,
|
|
1151
|
-
type_config=BarChartColumnConfig(
|
|
1263
|
+
type_config=BarChartColumnConfig(
|
|
1264
|
+
type="bar_chart", y_min=y_min, y_max=y_max, color=color
|
|
1265
|
+
),
|
|
1152
1266
|
)
|
|
1153
1267
|
|
|
1154
1268
|
|
|
@@ -1161,6 +1275,7 @@ def LineChartColumn(
|
|
|
1161
1275
|
pinned: bool | None = None,
|
|
1162
1276
|
y_min: int | float | None = None,
|
|
1163
1277
|
y_max: int | float | None = None,
|
|
1278
|
+
color: ChartColor | None = None,
|
|
1164
1279
|
) -> ColumnConfig:
|
|
1165
1280
|
"""Configure a line chart column in ``st.dataframe`` or ``st.data_editor``.
|
|
1166
1281
|
|
|
@@ -1170,11 +1285,11 @@ def LineChartColumn(
|
|
|
1170
1285
|
|
|
1171
1286
|
Parameters
|
|
1172
1287
|
----------
|
|
1173
|
-
label: str or None
|
|
1288
|
+
label : str or None
|
|
1174
1289
|
The label shown at the top of the column. If this is ``None``
|
|
1175
1290
|
(default), the column name is used.
|
|
1176
1291
|
|
|
1177
|
-
width: "small", "medium", "large", int, or None
|
|
1292
|
+
width : "small", "medium", "large", int, or None
|
|
1178
1293
|
The display width of the column. If this is ``None`` (default), the
|
|
1179
1294
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1180
1295
|
one of the following:
|
|
@@ -1184,7 +1299,11 @@ def LineChartColumn(
|
|
|
1184
1299
|
- ``"large"``: 400px wide
|
|
1185
1300
|
- An integer specifying the width in pixels
|
|
1186
1301
|
|
|
1187
|
-
|
|
1302
|
+
If the total width of all columns is less than the width of the
|
|
1303
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1304
|
+
columns.
|
|
1305
|
+
|
|
1306
|
+
help : str or None
|
|
1188
1307
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1189
1308
|
this is ``None`` (default), no tooltip is displayed.
|
|
1190
1309
|
|
|
@@ -1192,20 +1311,33 @@ def LineChartColumn(
|
|
|
1192
1311
|
the Markdown directives described in the ``body`` parameter of
|
|
1193
1312
|
``st.markdown``.
|
|
1194
1313
|
|
|
1195
|
-
pinned: bool or None
|
|
1314
|
+
pinned : bool or None
|
|
1196
1315
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1197
1316
|
left side no matter where the user scrolls. If this is ``None``
|
|
1198
1317
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1199
1318
|
columns are not pinned.
|
|
1200
1319
|
|
|
1201
|
-
y_min: int, float, or None
|
|
1320
|
+
y_min : int, float, or None
|
|
1202
1321
|
The minimum value on the y-axis for all cells in the column. If this is
|
|
1203
1322
|
``None`` (default), every cell will use the minimum of its data.
|
|
1204
1323
|
|
|
1205
|
-
y_max: int, float, or None
|
|
1324
|
+
y_max : int, float, or None
|
|
1206
1325
|
The maximum value on the y-axis for all cells in the column. If this is
|
|
1207
1326
|
``None`` (default), every cell will use the maximum of its data.
|
|
1208
1327
|
|
|
1328
|
+
color : "auto", "auto-inverse", str, or None
|
|
1329
|
+
The color to use for the chart. This can be one of the following:
|
|
1330
|
+
|
|
1331
|
+
- ``None`` (default): The primary color is used.
|
|
1332
|
+
- ``"auto"``: If the data is increasing, the chart is green; if the
|
|
1333
|
+
data is decreasing, the chart is red.
|
|
1334
|
+
- ``"auto-inverse"``: If the data is increasing, the chart is red; if
|
|
1335
|
+
the data is decreasing, the chart is green.
|
|
1336
|
+
- A single color value that is applied to all charts in the column.
|
|
1337
|
+
In addition to the basic color palette (red, orange, yellow, green,
|
|
1338
|
+
blue, violet, gray/grey, and primary), this supports hex codes like
|
|
1339
|
+
``"#483d8b"``.
|
|
1340
|
+
|
|
1209
1341
|
Examples
|
|
1210
1342
|
--------
|
|
1211
1343
|
>>> import pandas as pd
|
|
@@ -1240,13 +1372,16 @@ def LineChartColumn(
|
|
|
1240
1372
|
https://doc-linechart-column.streamlit.app/
|
|
1241
1373
|
height: 300px
|
|
1242
1374
|
"""
|
|
1243
|
-
|
|
1375
|
+
if color is not None:
|
|
1376
|
+
_validate_chart_color(color)
|
|
1244
1377
|
return ColumnConfig(
|
|
1245
1378
|
label=label,
|
|
1246
1379
|
width=width,
|
|
1247
1380
|
help=help,
|
|
1248
1381
|
pinned=pinned,
|
|
1249
|
-
type_config=LineChartColumnConfig(
|
|
1382
|
+
type_config=LineChartColumnConfig(
|
|
1383
|
+
type="line_chart", y_min=y_min, y_max=y_max, color=color
|
|
1384
|
+
),
|
|
1250
1385
|
)
|
|
1251
1386
|
|
|
1252
1387
|
|
|
@@ -1259,6 +1394,7 @@ def AreaChartColumn(
|
|
|
1259
1394
|
pinned: bool | None = None,
|
|
1260
1395
|
y_min: int | float | None = None,
|
|
1261
1396
|
y_max: int | float | None = None,
|
|
1397
|
+
color: ChartColor | None = None,
|
|
1262
1398
|
) -> ColumnConfig:
|
|
1263
1399
|
"""Configure an area chart column in ``st.dataframe`` or ``st.data_editor``.
|
|
1264
1400
|
|
|
@@ -1268,11 +1404,11 @@ def AreaChartColumn(
|
|
|
1268
1404
|
|
|
1269
1405
|
Parameters
|
|
1270
1406
|
----------
|
|
1271
|
-
label: str or None
|
|
1407
|
+
label : str or None
|
|
1272
1408
|
The label shown at the top of the column. If this is ``None``
|
|
1273
1409
|
(default), the column name is used.
|
|
1274
1410
|
|
|
1275
|
-
width: "small", "medium", "large", int, or None
|
|
1411
|
+
width : "small", "medium", "large", int, or None
|
|
1276
1412
|
The display width of the column. If this is ``None`` (default), the
|
|
1277
1413
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1278
1414
|
one of the following:
|
|
@@ -1282,7 +1418,11 @@ def AreaChartColumn(
|
|
|
1282
1418
|
- ``"large"``: 400px wide
|
|
1283
1419
|
- An integer specifying the width in pixels
|
|
1284
1420
|
|
|
1285
|
-
|
|
1421
|
+
If the total width of all columns is less than the width of the
|
|
1422
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1423
|
+
columns.
|
|
1424
|
+
|
|
1425
|
+
help : str or None
|
|
1286
1426
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1287
1427
|
this is ``None`` (default), no tooltip is displayed.
|
|
1288
1428
|
|
|
@@ -1290,20 +1430,35 @@ def AreaChartColumn(
|
|
|
1290
1430
|
the Markdown directives described in the ``body`` parameter of
|
|
1291
1431
|
``st.markdown``.
|
|
1292
1432
|
|
|
1293
|
-
pinned: bool or None
|
|
1433
|
+
pinned : bool or None
|
|
1294
1434
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1295
1435
|
left side no matter where the user scrolls. If this is ``None``
|
|
1296
1436
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1297
1437
|
columns are not pinned.
|
|
1298
1438
|
|
|
1299
|
-
y_min: int, float, or None
|
|
1439
|
+
y_min : int, float, or None
|
|
1300
1440
|
The minimum value on the y-axis for all cells in the column. If this is
|
|
1301
1441
|
``None`` (default), every cell will use the minimum of its data.
|
|
1302
1442
|
|
|
1303
|
-
y_max: int, float, or None
|
|
1443
|
+
y_max : int, float, or None
|
|
1304
1444
|
The maximum value on the y-axis for all cells in the column. If this is
|
|
1305
1445
|
``None`` (default), every cell will use the maximum of its data.
|
|
1306
1446
|
|
|
1447
|
+
color : "auto", "auto-inverse", str, or None
|
|
1448
|
+
The color to use for the chart. This can be one of the following:
|
|
1449
|
+
|
|
1450
|
+
- ``None`` (default): The primary color is used.
|
|
1451
|
+
- ``"auto"``: If the data is increasing, the chart is green; if the
|
|
1452
|
+
data is decreasing, the chart is red.
|
|
1453
|
+
- ``"auto-inverse"``: If the data is increasing, the chart is red; if
|
|
1454
|
+
the data is decreasing, the chart is green.
|
|
1455
|
+
- A single color value that is applied to all charts in the column.
|
|
1456
|
+
In addition to the basic color palette (red, orange, yellow, green,
|
|
1457
|
+
blue, violet, gray/grey, and primary), this supports hex codes like
|
|
1458
|
+
``"#483d8b"``.
|
|
1459
|
+
|
|
1460
|
+
The basic color palette can be configured in the theme settings.
|
|
1461
|
+
|
|
1307
1462
|
Examples
|
|
1308
1463
|
--------
|
|
1309
1464
|
>>> import pandas as pd
|
|
@@ -1339,12 +1494,16 @@ def AreaChartColumn(
|
|
|
1339
1494
|
height: 300px
|
|
1340
1495
|
"""
|
|
1341
1496
|
|
|
1497
|
+
if color is not None:
|
|
1498
|
+
_validate_chart_color(color)
|
|
1342
1499
|
return ColumnConfig(
|
|
1343
1500
|
label=label,
|
|
1344
1501
|
width=width,
|
|
1345
1502
|
help=help,
|
|
1346
1503
|
pinned=pinned,
|
|
1347
|
-
type_config=AreaChartColumnConfig(
|
|
1504
|
+
type_config=AreaChartColumnConfig(
|
|
1505
|
+
type="area_chart", y_min=y_min, y_max=y_max, color=color
|
|
1506
|
+
),
|
|
1348
1507
|
)
|
|
1349
1508
|
|
|
1350
1509
|
|
|
@@ -1372,11 +1531,11 @@ def ImageColumn(
|
|
|
1372
1531
|
|
|
1373
1532
|
Parameters
|
|
1374
1533
|
----------
|
|
1375
|
-
label: str or None
|
|
1534
|
+
label : str or None
|
|
1376
1535
|
The label shown at the top of the column. If this is ``None``
|
|
1377
1536
|
(default), the column name is used.
|
|
1378
1537
|
|
|
1379
|
-
width: "small", "medium", "large", int, or None
|
|
1538
|
+
width : "small", "medium", "large", int, or None
|
|
1380
1539
|
The display width of the column. If this is ``None`` (default), the
|
|
1381
1540
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1382
1541
|
one of the following:
|
|
@@ -1386,7 +1545,11 @@ def ImageColumn(
|
|
|
1386
1545
|
- ``"large"``: 400px wide
|
|
1387
1546
|
- An integer specifying the width in pixels
|
|
1388
1547
|
|
|
1389
|
-
|
|
1548
|
+
If the total width of all columns is less than the width of the
|
|
1549
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1550
|
+
columns.
|
|
1551
|
+
|
|
1552
|
+
help : str or None
|
|
1390
1553
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1391
1554
|
this is ``None`` (default), no tooltip is displayed.
|
|
1392
1555
|
|
|
@@ -1394,7 +1557,7 @@ def ImageColumn(
|
|
|
1394
1557
|
the Markdown directives described in the ``body`` parameter of
|
|
1395
1558
|
``st.markdown``.
|
|
1396
1559
|
|
|
1397
|
-
pinned: bool or None
|
|
1560
|
+
pinned : bool or None
|
|
1398
1561
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1399
1562
|
left side no matter where the user scrolls. If this is ``None``
|
|
1400
1563
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
@@ -1454,20 +1617,21 @@ def ListColumn(
|
|
|
1454
1617
|
|
|
1455
1618
|
This is the default column type for list-like values. This command needs to
|
|
1456
1619
|
be used in the ``column_config`` parameter of ``st.dataframe`` or
|
|
1457
|
-
``st.data_editor``.
|
|
1620
|
+
``st.data_editor``. When used with ``st.data_editor``, users can freely
|
|
1621
|
+
type in new options and remove existing ones.
|
|
1458
1622
|
|
|
1459
1623
|
.. Note::
|
|
1460
1624
|
Editing for non-string or mixed type lists can cause issues with Arrow
|
|
1461
|
-
serialization. We recommend you disable editing for these columns
|
|
1462
|
-
convert
|
|
1625
|
+
serialization. We recommend that you disable editing for these columns
|
|
1626
|
+
or convert all list values to strings.
|
|
1463
1627
|
|
|
1464
1628
|
Parameters
|
|
1465
1629
|
----------
|
|
1466
|
-
label: str or None
|
|
1630
|
+
label : str or None
|
|
1467
1631
|
The label shown at the top of the column. If this is ``None``
|
|
1468
1632
|
(default), the column name is used.
|
|
1469
1633
|
|
|
1470
|
-
width: "small", "medium", "large", int, or None
|
|
1634
|
+
width : "small", "medium", "large", int, or None
|
|
1471
1635
|
The display width of the column. If this is ``None`` (default), the
|
|
1472
1636
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1473
1637
|
one of the following:
|
|
@@ -1477,7 +1641,11 @@ def ListColumn(
|
|
|
1477
1641
|
- ``"large"``: 400px wide
|
|
1478
1642
|
- An integer specifying the width in pixels
|
|
1479
1643
|
|
|
1480
|
-
|
|
1644
|
+
If the total width of all columns is less than the width of the
|
|
1645
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1646
|
+
columns.
|
|
1647
|
+
|
|
1648
|
+
help : str or None
|
|
1481
1649
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1482
1650
|
this is ``None`` (default), no tooltip is displayed.
|
|
1483
1651
|
|
|
@@ -1485,27 +1653,27 @@ def ListColumn(
|
|
|
1485
1653
|
the Markdown directives described in the ``body`` parameter of
|
|
1486
1654
|
``st.markdown``.
|
|
1487
1655
|
|
|
1488
|
-
pinned: bool or None
|
|
1656
|
+
pinned : bool or None
|
|
1489
1657
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1490
1658
|
left side no matter where the user scrolls. If this is ``None``
|
|
1491
1659
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1492
1660
|
columns are not pinned.
|
|
1493
1661
|
|
|
1494
|
-
disabled: bool or None
|
|
1662
|
+
disabled : bool or None
|
|
1495
1663
|
Whether editing should be disabled for this column. If this is ``None``
|
|
1496
1664
|
(default), Streamlit will enable editing wherever possible.
|
|
1497
1665
|
|
|
1498
1666
|
If a column has mixed types, it may become uneditable regardless of
|
|
1499
1667
|
``disabled``.
|
|
1500
1668
|
|
|
1501
|
-
required: bool or None
|
|
1669
|
+
required : bool or None
|
|
1502
1670
|
Whether edited cells in the column need to have a value. If this is
|
|
1503
1671
|
``False`` (default), the user can submit empty values for this column.
|
|
1504
1672
|
If this is ``True``, an edited cell in this column can only be
|
|
1505
1673
|
submitted if its value is not ``None``, and a new row will only be
|
|
1506
1674
|
submitted after the user fills in this column.
|
|
1507
1675
|
|
|
1508
|
-
default: Iterable of str or None
|
|
1676
|
+
default : Iterable of str or None
|
|
1509
1677
|
Specifies the default value in this column when a new row is added by
|
|
1510
1678
|
the user. This defaults to ``None``.
|
|
1511
1679
|
|
|
@@ -1553,6 +1721,247 @@ def ListColumn(
|
|
|
1553
1721
|
)
|
|
1554
1722
|
|
|
1555
1723
|
|
|
1724
|
+
@gather_metrics("column_config.MultiselectColumn")
|
|
1725
|
+
def MultiselectColumn(
|
|
1726
|
+
label: str | None = None,
|
|
1727
|
+
*,
|
|
1728
|
+
width: ColumnWidth | None = None,
|
|
1729
|
+
help: str | None = None,
|
|
1730
|
+
disabled: bool | None = None,
|
|
1731
|
+
required: bool | None = None,
|
|
1732
|
+
pinned: bool | None = None,
|
|
1733
|
+
default: Iterable[str] | None = None,
|
|
1734
|
+
options: Iterable[str] | None = None,
|
|
1735
|
+
accept_new_options: bool | None = None,
|
|
1736
|
+
color: str
|
|
1737
|
+
| Literal["auto"]
|
|
1738
|
+
| ThemeColor
|
|
1739
|
+
| Iterable[str | ThemeColor]
|
|
1740
|
+
| None = None,
|
|
1741
|
+
format_func: Callable[[str], str] | None = None,
|
|
1742
|
+
) -> ColumnConfig:
|
|
1743
|
+
"""Configure a multiselect column in ``st.dataframe`` or ``st.data_editor``.
|
|
1744
|
+
|
|
1745
|
+
This command needs to be used in the ``column_config`` parameter of
|
|
1746
|
+
``st.dataframe`` or ``st.data_editor``. When used with ``st.data_editor``,
|
|
1747
|
+
users can select options from a dropdown menu. You can configure the
|
|
1748
|
+
column to allow freely typed options, too.
|
|
1749
|
+
|
|
1750
|
+
You can also use this column type to display colored labels in a read-only
|
|
1751
|
+
``st.dataframe``.
|
|
1752
|
+
|
|
1753
|
+
.. Note::
|
|
1754
|
+
Editing for non-string or mixed type lists can cause issues with Arrow
|
|
1755
|
+
serialization. We recommend that you disable editing for these columns
|
|
1756
|
+
or convert all list values to strings.
|
|
1757
|
+
|
|
1758
|
+
Parameters
|
|
1759
|
+
----------
|
|
1760
|
+
label : str or None
|
|
1761
|
+
The label shown at the top of the column. If None (default),
|
|
1762
|
+
the column name is used.
|
|
1763
|
+
|
|
1764
|
+
width : "small", "medium", "large", or None
|
|
1765
|
+
The display width of the column. If this is ``None`` (default), the
|
|
1766
|
+
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1767
|
+
one of the following:
|
|
1768
|
+
|
|
1769
|
+
- ``"small"``: 75px wide
|
|
1770
|
+
- ``"medium"``: 200px wide
|
|
1771
|
+
- ``"large"``: 400px wide
|
|
1772
|
+
- An integer specifying the width in pixels
|
|
1773
|
+
|
|
1774
|
+
If the total width of all columns is less than the width of the
|
|
1775
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
1776
|
+
columns.
|
|
1777
|
+
|
|
1778
|
+
help : str or None
|
|
1779
|
+
A tooltip that gets displayed when hovering over the column label. If
|
|
1780
|
+
this is ``None`` (default), no tooltip is displayed.
|
|
1781
|
+
|
|
1782
|
+
The tooltip can optionally contain GitHub-flavored Markdown, including
|
|
1783
|
+
the Markdown directives described in the ``body`` parameter of
|
|
1784
|
+
``st.markdown``.
|
|
1785
|
+
|
|
1786
|
+
disabled : bool or None
|
|
1787
|
+
Whether editing should be disabled for this column. Defaults to False.
|
|
1788
|
+
|
|
1789
|
+
required : bool or None
|
|
1790
|
+
Whether edited cells in the column need to have a value. If True, an edited cell
|
|
1791
|
+
can only be submitted if it has a value other than None. Defaults to False.
|
|
1792
|
+
|
|
1793
|
+
pinned : bool or None
|
|
1794
|
+
Whether the column is pinned. A pinned column will stay visible on the
|
|
1795
|
+
left side no matter where the user scrolls. If this is ``None``
|
|
1796
|
+
(default), Streamlit will decide: index columns are pinned, and data
|
|
1797
|
+
columns are not pinned.
|
|
1798
|
+
|
|
1799
|
+
default : Iterable of str or None
|
|
1800
|
+
Specifies the default value in this column when a new row is added by the user.
|
|
1801
|
+
|
|
1802
|
+
options : Iterable of str or None
|
|
1803
|
+
The options that can be selected during editing.
|
|
1804
|
+
|
|
1805
|
+
accept_new_options : bool or None
|
|
1806
|
+
Whether the user can add selections that aren't included in ``options``.
|
|
1807
|
+
If this is ``False`` (default), the user can only select from the
|
|
1808
|
+
items in ``options``. If this is ``True``, the user can enter new
|
|
1809
|
+
items that don't exist in ``options``.
|
|
1810
|
+
|
|
1811
|
+
When a user enters and selects a new item, it is included in the
|
|
1812
|
+
returned cell list value as a string. The new item is not added to
|
|
1813
|
+
the options drop-down menu.
|
|
1814
|
+
|
|
1815
|
+
color : str, Iterable of str, or None
|
|
1816
|
+
The color to use for different options. This can be:
|
|
1817
|
+
|
|
1818
|
+
- None (default): The options are displayed without color.
|
|
1819
|
+
- ``"auto"``: The options are colored based on the configured categorical chart colors.
|
|
1820
|
+
- A single color value that is used for all options. This can be one of
|
|
1821
|
+
the following strings:
|
|
1822
|
+
|
|
1823
|
+
- ``"primary"`` to use the primary theme color.
|
|
1824
|
+
- A CSS named color name like ``"darkBlue"`` or ``"maroon"``.
|
|
1825
|
+
- A hex color code like ``"#483d8b"`` or ``"#6A5ACD80"``.
|
|
1826
|
+
- An RGB or RGBA color code like ``"rgb(255,0,0)"`` or
|
|
1827
|
+
``"RGB(70, 130, 180, .7)"``.
|
|
1828
|
+
- An HSL or HSLA color code like ``"hsl(248, 53%, 58%)"``
|
|
1829
|
+
or ``"HSL(147, 50%, 47%, .3)"``.
|
|
1830
|
+
|
|
1831
|
+
- An iterable of color values that are mapped to the options. The colors
|
|
1832
|
+
are applied in sequence, cycling through the iterable if there are
|
|
1833
|
+
more options than colors.
|
|
1834
|
+
|
|
1835
|
+
format_func : function or None
|
|
1836
|
+
Function to modify the display of the options. It receives
|
|
1837
|
+
the raw option defined in ``options`` as an argument and should output
|
|
1838
|
+
the label to be shown for that option. When used in ``st.data_editor``,
|
|
1839
|
+
this has no impact on the returned value. If this is ``None``
|
|
1840
|
+
(default), the raw option is used as the label.
|
|
1841
|
+
|
|
1842
|
+
Examples
|
|
1843
|
+
--------
|
|
1844
|
+
**Example 1: Editable multiselect column**
|
|
1845
|
+
|
|
1846
|
+
To customize the label colors, provide a list of colors to the ``color``
|
|
1847
|
+
parameter. You can also format the option labels with the ``format_func``
|
|
1848
|
+
parameter.
|
|
1849
|
+
|
|
1850
|
+
>>> import pandas as pd
|
|
1851
|
+
>>> import streamlit as st
|
|
1852
|
+
>>>
|
|
1853
|
+
>>> data_df = pd.DataFrame(
|
|
1854
|
+
... {
|
|
1855
|
+
... "category": [
|
|
1856
|
+
... ["exploration", "visualization"],
|
|
1857
|
+
... ["llm", "visualization"],
|
|
1858
|
+
... ["exploration"],
|
|
1859
|
+
... ],
|
|
1860
|
+
... }
|
|
1861
|
+
... )
|
|
1862
|
+
>>>
|
|
1863
|
+
>>> st.data_editor(
|
|
1864
|
+
... data_df,
|
|
1865
|
+
... column_config={
|
|
1866
|
+
... "category": st.column_config.MultiselectColumn(
|
|
1867
|
+
... "App Categories",
|
|
1868
|
+
... help="The categories of the app",
|
|
1869
|
+
... options=[
|
|
1870
|
+
... "exploration",
|
|
1871
|
+
... "visualization",
|
|
1872
|
+
... "llm",
|
|
1873
|
+
... ],
|
|
1874
|
+
... color=["#ffa421", "#803df5", "#00c0f2"],
|
|
1875
|
+
... format_func=lambda x: x.capitalize(),
|
|
1876
|
+
... ),
|
|
1877
|
+
... },
|
|
1878
|
+
... )
|
|
1879
|
+
|
|
1880
|
+
.. output::
|
|
1881
|
+
https://doc-multiselect-column-1.streamlit.app/
|
|
1882
|
+
height: 300px
|
|
1883
|
+
|
|
1884
|
+
**Example 2: Colored tags for st.dataframe**
|
|
1885
|
+
|
|
1886
|
+
When using ``st.dataframe``, the multiselect column is read-only
|
|
1887
|
+
and can be used to display colored tags. In this example, the dataframe
|
|
1888
|
+
uses the primary theme color for all tags.
|
|
1889
|
+
|
|
1890
|
+
>>> import pandas as pd
|
|
1891
|
+
>>> import streamlit as st
|
|
1892
|
+
>>>
|
|
1893
|
+
>>> data_df = pd.DataFrame(
|
|
1894
|
+
... {
|
|
1895
|
+
... "category": [
|
|
1896
|
+
... ["exploration", "visualization"],
|
|
1897
|
+
... ["llm", "visualization"],
|
|
1898
|
+
... ["exploration"],
|
|
1899
|
+
... ],
|
|
1900
|
+
... }
|
|
1901
|
+
... )
|
|
1902
|
+
>>>
|
|
1903
|
+
>>> st.dataframe(
|
|
1904
|
+
... data_df,
|
|
1905
|
+
... column_config={
|
|
1906
|
+
... "category": st.column_config.MultiselectColumn(
|
|
1907
|
+
... "App Categories",
|
|
1908
|
+
... options=["exploration", "visualization", "llm"],
|
|
1909
|
+
... color="primary",
|
|
1910
|
+
... format_func=lambda x: x.capitalize(),
|
|
1911
|
+
... ),
|
|
1912
|
+
... },
|
|
1913
|
+
... )
|
|
1914
|
+
|
|
1915
|
+
.. output::
|
|
1916
|
+
https://doc-multiselect-column-2.streamlit.app/
|
|
1917
|
+
height: 300px
|
|
1918
|
+
"""
|
|
1919
|
+
|
|
1920
|
+
# Process options with color and format_func:
|
|
1921
|
+
processed_options: list[MultiselectOption] | None = None
|
|
1922
|
+
if options is not None:
|
|
1923
|
+
processed_options = []
|
|
1924
|
+
|
|
1925
|
+
# Convert color to an iterator
|
|
1926
|
+
color_iter: Iterator[str] | None = None
|
|
1927
|
+
if color is not None:
|
|
1928
|
+
if isinstance(color, str):
|
|
1929
|
+
# Single color for all options
|
|
1930
|
+
color_iter = itertools.repeat(color)
|
|
1931
|
+
else:
|
|
1932
|
+
# Iterable of colors - cycle through them
|
|
1933
|
+
color_iter = itertools.cycle(color)
|
|
1934
|
+
|
|
1935
|
+
for option in options:
|
|
1936
|
+
# Start with the option value
|
|
1937
|
+
option_dict = MultiselectOption(value=option)
|
|
1938
|
+
|
|
1939
|
+
# Apply format_func to generate label if not already present
|
|
1940
|
+
if format_func is not None:
|
|
1941
|
+
option_dict["label"] = format_func(option_dict["value"])
|
|
1942
|
+
|
|
1943
|
+
# Apply color if provided and not already present
|
|
1944
|
+
if color_iter is not None and "color" not in option_dict:
|
|
1945
|
+
option_dict["color"] = next(color_iter)
|
|
1946
|
+
|
|
1947
|
+
processed_options.append(option_dict)
|
|
1948
|
+
|
|
1949
|
+
return ColumnConfig(
|
|
1950
|
+
label=label,
|
|
1951
|
+
width=width,
|
|
1952
|
+
help=help,
|
|
1953
|
+
disabled=disabled,
|
|
1954
|
+
required=required,
|
|
1955
|
+
pinned=pinned,
|
|
1956
|
+
default=None if default is None else list(default),
|
|
1957
|
+
type_config=MultiselectColumnConfig(
|
|
1958
|
+
type="multiselect",
|
|
1959
|
+
options=processed_options,
|
|
1960
|
+
accept_new_options=accept_new_options,
|
|
1961
|
+
),
|
|
1962
|
+
)
|
|
1963
|
+
|
|
1964
|
+
|
|
1556
1965
|
@gather_metrics("column_config.DatetimeColumn")
|
|
1557
1966
|
def DatetimeColumn(
|
|
1558
1967
|
label: str | None = None,
|
|
@@ -1578,11 +1987,11 @@ def DatetimeColumn(
|
|
|
1578
1987
|
|
|
1579
1988
|
Parameters
|
|
1580
1989
|
----------
|
|
1581
|
-
label: str or None
|
|
1990
|
+
label : str or None
|
|
1582
1991
|
The label shown at the top of the column. If this is ``None``
|
|
1583
1992
|
(default), the column name is used.
|
|
1584
1993
|
|
|
1585
|
-
width: "small", "medium", "large", int, or None
|
|
1994
|
+
width : "small", "medium", "large", int, or None
|
|
1586
1995
|
The display width of the column. If this is ``None`` (default), the
|
|
1587
1996
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1588
1997
|
one of the following:
|
|
@@ -1592,7 +2001,11 @@ def DatetimeColumn(
|
|
|
1592
2001
|
- ``"large"``: 400px wide
|
|
1593
2002
|
- An integer specifying the width in pixels
|
|
1594
2003
|
|
|
1595
|
-
|
|
2004
|
+
If the total width of all columns is less than the width of the
|
|
2005
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
2006
|
+
columns.
|
|
2007
|
+
|
|
2008
|
+
help : str or None
|
|
1596
2009
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1597
2010
|
this is ``None`` (default), no tooltip is displayed.
|
|
1598
2011
|
|
|
@@ -1600,31 +2013,31 @@ def DatetimeColumn(
|
|
|
1600
2013
|
the Markdown directives described in the ``body`` parameter of
|
|
1601
2014
|
``st.markdown``.
|
|
1602
2015
|
|
|
1603
|
-
disabled: bool or None
|
|
2016
|
+
disabled : bool or None
|
|
1604
2017
|
Whether editing should be disabled for this column. If this is ``None``
|
|
1605
2018
|
(default), Streamlit will enable editing wherever possible.
|
|
1606
2019
|
|
|
1607
2020
|
If a column has mixed types, it may become uneditable regardless of
|
|
1608
2021
|
``disabled``.
|
|
1609
2022
|
|
|
1610
|
-
required: bool or None
|
|
2023
|
+
required : bool or None
|
|
1611
2024
|
Whether edited cells in the column need to have a value. If this is
|
|
1612
2025
|
``False`` (default), the user can submit empty values for this column.
|
|
1613
2026
|
If this is ``True``, an edited cell in this column can only be
|
|
1614
2027
|
submitted if its value is not ``None``, and a new row will only be
|
|
1615
2028
|
submitted after the user fills in this column.
|
|
1616
2029
|
|
|
1617
|
-
pinned: bool or None
|
|
2030
|
+
pinned : bool or None
|
|
1618
2031
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1619
2032
|
left side no matter where the user scrolls. If this is ``None``
|
|
1620
2033
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1621
2034
|
columns are not pinned.
|
|
1622
2035
|
|
|
1623
|
-
default: datetime.datetime or None
|
|
2036
|
+
default : datetime.datetime or None
|
|
1624
2037
|
Specifies the default value in this column when a new row is added by
|
|
1625
2038
|
the user. This defaults to ``None``.
|
|
1626
2039
|
|
|
1627
|
-
format: str, "localized", "distance", "calendar", "iso8601", or None
|
|
2040
|
+
format : str, "localized", "distance", "calendar", "iso8601", or None
|
|
1628
2041
|
A format string controlling how datetimes are displayed.
|
|
1629
2042
|
This can be one of the following values:
|
|
1630
2043
|
|
|
@@ -1646,19 +2059,19 @@ def DatetimeColumn(
|
|
|
1646
2059
|
formatting from ``pandas.Styler``. The formatting does not impact the
|
|
1647
2060
|
return value when used in ``st.data_editor``.
|
|
1648
2061
|
|
|
1649
|
-
min_value: datetime.datetime or None
|
|
2062
|
+
min_value : datetime.datetime or None
|
|
1650
2063
|
The minimum datetime that can be entered. If this is ``None``
|
|
1651
2064
|
(default), there will be no minimum.
|
|
1652
2065
|
|
|
1653
|
-
max_value: datetime.datetime or None
|
|
2066
|
+
max_value : datetime.datetime or None
|
|
1654
2067
|
The maximum datetime that can be entered. If this is ``None``
|
|
1655
2068
|
(default), there will be no maximum.
|
|
1656
2069
|
|
|
1657
|
-
step: int, float, datetime.timedelta, or None
|
|
2070
|
+
step : int, float, datetime.timedelta, or None
|
|
1658
2071
|
The stepping interval in seconds. If this is ``None`` (default), the
|
|
1659
2072
|
step will be 1 second.
|
|
1660
2073
|
|
|
1661
|
-
timezone: str or None
|
|
2074
|
+
timezone : str or None
|
|
1662
2075
|
The timezone of this column. If this is ``None`` (default), the
|
|
1663
2076
|
timezone is inferred from the underlying data.
|
|
1664
2077
|
|
|
@@ -1740,11 +2153,11 @@ def TimeColumn(
|
|
|
1740
2153
|
|
|
1741
2154
|
Parameters
|
|
1742
2155
|
----------
|
|
1743
|
-
label: str or None
|
|
2156
|
+
label : str or None
|
|
1744
2157
|
The label shown at the top of the column. If this is ``None``
|
|
1745
2158
|
(default), the column name is used.
|
|
1746
2159
|
|
|
1747
|
-
width: "small", "medium", "large", int, or None
|
|
2160
|
+
width : "small", "medium", "large", int, or None
|
|
1748
2161
|
The display width of the column. If this is ``None`` (default), the
|
|
1749
2162
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1750
2163
|
one of the following:
|
|
@@ -1754,7 +2167,11 @@ def TimeColumn(
|
|
|
1754
2167
|
- ``"large"``: 400px wide
|
|
1755
2168
|
- An integer specifying the width in pixels
|
|
1756
2169
|
|
|
1757
|
-
|
|
2170
|
+
If the total width of all columns is less than the width of the
|
|
2171
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
2172
|
+
columns.
|
|
2173
|
+
|
|
2174
|
+
help : str or None
|
|
1758
2175
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1759
2176
|
this is ``None`` (default), no tooltip is displayed.
|
|
1760
2177
|
|
|
@@ -1762,31 +2179,31 @@ def TimeColumn(
|
|
|
1762
2179
|
the Markdown directives described in the ``body`` parameter of
|
|
1763
2180
|
``st.markdown``.
|
|
1764
2181
|
|
|
1765
|
-
disabled: bool or None
|
|
2182
|
+
disabled : bool or None
|
|
1766
2183
|
Whether editing should be disabled for this column. If this is ``None``
|
|
1767
2184
|
(default), Streamlit will enable editing wherever possible.
|
|
1768
2185
|
|
|
1769
2186
|
If a column has mixed types, it may become uneditable regardless of
|
|
1770
2187
|
``disabled``.
|
|
1771
2188
|
|
|
1772
|
-
required: bool or None
|
|
2189
|
+
required : bool or None
|
|
1773
2190
|
Whether edited cells in the column need to have a value. If this is
|
|
1774
2191
|
``False`` (default), the user can submit empty values for this column.
|
|
1775
2192
|
If this is ``True``, an edited cell in this column can only be
|
|
1776
2193
|
submitted if its value is not ``None``, and a new row will only be
|
|
1777
2194
|
submitted after the user fills in this column.
|
|
1778
2195
|
|
|
1779
|
-
pinned: bool or None
|
|
2196
|
+
pinned : bool or None
|
|
1780
2197
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1781
2198
|
left side no matter where the user scrolls. If this is ``None``
|
|
1782
2199
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1783
2200
|
columns are not pinned.
|
|
1784
2201
|
|
|
1785
|
-
default: datetime.time or None
|
|
2202
|
+
default : datetime.time or None
|
|
1786
2203
|
Specifies the default value in this column when a new row is added by
|
|
1787
2204
|
the user. This defaults to ``None``.
|
|
1788
2205
|
|
|
1789
|
-
format: str, "localized", "iso8601", or None
|
|
2206
|
+
format : str, "localized", "iso8601", or None
|
|
1790
2207
|
A format string controlling how times are displayed.
|
|
1791
2208
|
This can be one of the following values:
|
|
1792
2209
|
|
|
@@ -1804,15 +2221,15 @@ def TimeColumn(
|
|
|
1804
2221
|
formatting from ``pandas.Styler``. The formatting does not impact the
|
|
1805
2222
|
return value when used in ``st.data_editor``.
|
|
1806
2223
|
|
|
1807
|
-
min_value: datetime.time or None
|
|
2224
|
+
min_value : datetime.time or None
|
|
1808
2225
|
The minimum time that can be entered. If this is ``None`` (default),
|
|
1809
2226
|
there will be no minimum.
|
|
1810
2227
|
|
|
1811
|
-
max_value: datetime.time or None
|
|
2228
|
+
max_value : datetime.time or None
|
|
1812
2229
|
The maximum time that can be entered. If this is ``None`` (default),
|
|
1813
2230
|
there will be no maximum.
|
|
1814
2231
|
|
|
1815
|
-
step: int, float, datetime.timedelta, or None
|
|
2232
|
+
step : int, float, datetime.timedelta, or None
|
|
1816
2233
|
The stepping interval in seconds. If this is ``None`` (default), the
|
|
1817
2234
|
step will be 1 second.
|
|
1818
2235
|
|
|
@@ -1893,11 +2310,11 @@ def DateColumn(
|
|
|
1893
2310
|
|
|
1894
2311
|
Parameters
|
|
1895
2312
|
----------
|
|
1896
|
-
label: str or None
|
|
2313
|
+
label : str or None
|
|
1897
2314
|
The label shown at the top of the column. If this is ``None``
|
|
1898
2315
|
(default), the column name is used.
|
|
1899
2316
|
|
|
1900
|
-
width: "small", "medium", "large", int, or None
|
|
2317
|
+
width : "small", "medium", "large", int, or None
|
|
1901
2318
|
The display width of the column. If this is ``None`` (default), the
|
|
1902
2319
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
1903
2320
|
one of the following:
|
|
@@ -1907,7 +2324,11 @@ def DateColumn(
|
|
|
1907
2324
|
- ``"large"``: 400px wide
|
|
1908
2325
|
- An integer specifying the width in pixels
|
|
1909
2326
|
|
|
1910
|
-
|
|
2327
|
+
If the total width of all columns is less than the width of the
|
|
2328
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
2329
|
+
columns.
|
|
2330
|
+
|
|
2331
|
+
help : str or None
|
|
1911
2332
|
A tooltip that gets displayed when hovering over the column label. If
|
|
1912
2333
|
this is ``None`` (default), no tooltip is displayed.
|
|
1913
2334
|
|
|
@@ -1915,31 +2336,31 @@ def DateColumn(
|
|
|
1915
2336
|
the Markdown directives described in the ``body`` parameter of
|
|
1916
2337
|
``st.markdown``.
|
|
1917
2338
|
|
|
1918
|
-
disabled: bool or None
|
|
2339
|
+
disabled : bool or None
|
|
1919
2340
|
Whether editing should be disabled for this column. If this is ``None``
|
|
1920
2341
|
(default), Streamlit will enable editing wherever possible.
|
|
1921
2342
|
|
|
1922
2343
|
If a column has mixed types, it may become uneditable regardless of
|
|
1923
2344
|
``disabled``.
|
|
1924
2345
|
|
|
1925
|
-
required: bool or None
|
|
2346
|
+
required : bool or None
|
|
1926
2347
|
Whether edited cells in the column need to have a value. If this is
|
|
1927
2348
|
``False`` (default), the user can submit empty values for this column.
|
|
1928
2349
|
If this is ``True``, an edited cell in this column can only be
|
|
1929
2350
|
submitted if its value is not ``None``, and a new row will only be
|
|
1930
2351
|
submitted after the user fills in this column.
|
|
1931
2352
|
|
|
1932
|
-
pinned: bool or None
|
|
2353
|
+
pinned : bool or None
|
|
1933
2354
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
1934
2355
|
left side no matter where the user scrolls. If this is ``None``
|
|
1935
2356
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
1936
2357
|
columns are not pinned.
|
|
1937
2358
|
|
|
1938
|
-
default: datetime.date or None
|
|
2359
|
+
default : datetime.date or None
|
|
1939
2360
|
Specifies the default value in this column when a new row is added by
|
|
1940
2361
|
the user. This defaults to ``None``.
|
|
1941
2362
|
|
|
1942
|
-
format: str, "localized", "distance", "iso8601", or None
|
|
2363
|
+
format : str, "localized", "distance", "iso8601", or None
|
|
1943
2364
|
A format string controlling how dates are displayed.
|
|
1944
2365
|
This can be one of the following values:
|
|
1945
2366
|
|
|
@@ -1959,15 +2380,15 @@ def DateColumn(
|
|
|
1959
2380
|
formatting from ``pandas.Styler``. The formatting does not impact the
|
|
1960
2381
|
return value when used in ``st.data_editor``.
|
|
1961
2382
|
|
|
1962
|
-
min_value: datetime.date or None
|
|
2383
|
+
min_value : datetime.date or None
|
|
1963
2384
|
The minimum date that can be entered. If this is ``None`` (default),
|
|
1964
2385
|
there will be no minimum.
|
|
1965
2386
|
|
|
1966
|
-
max_value: datetime.date or None
|
|
2387
|
+
max_value : datetime.date or None
|
|
1967
2388
|
The maximum date that can be entered. If this is ``None`` (default),
|
|
1968
2389
|
there will be no maximum.
|
|
1969
2390
|
|
|
1970
|
-
step: int or None
|
|
2391
|
+
step : int or None
|
|
1971
2392
|
The stepping interval in days. If this is ``None`` (default), the step
|
|
1972
2393
|
will be 1 day.
|
|
1973
2394
|
|
|
@@ -2035,6 +2456,7 @@ def ProgressColumn(
|
|
|
2035
2456
|
min_value: int | float | None = None,
|
|
2036
2457
|
max_value: int | float | None = None,
|
|
2037
2458
|
step: int | float | None = None,
|
|
2459
|
+
color: ChartColor | None = None,
|
|
2038
2460
|
) -> ColumnConfig:
|
|
2039
2461
|
"""Configure a progress column in ``st.dataframe`` or ``st.data_editor``.
|
|
2040
2462
|
|
|
@@ -2044,11 +2466,11 @@ def ProgressColumn(
|
|
|
2044
2466
|
|
|
2045
2467
|
Parameters
|
|
2046
2468
|
----------
|
|
2047
|
-
label: str or None
|
|
2469
|
+
label : str or None
|
|
2048
2470
|
The label shown at the top of the column. If this is ``None``
|
|
2049
2471
|
(default), the column name is used.
|
|
2050
2472
|
|
|
2051
|
-
width: "small", "medium", "large", int, or None
|
|
2473
|
+
width : "small", "medium", "large", int, or None
|
|
2052
2474
|
The display width of the column. If this is ``None`` (default), the
|
|
2053
2475
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
2054
2476
|
one of the following:
|
|
@@ -2058,7 +2480,11 @@ def ProgressColumn(
|
|
|
2058
2480
|
- ``"large"``: 400px wide
|
|
2059
2481
|
- An integer specifying the width in pixels
|
|
2060
2482
|
|
|
2061
|
-
|
|
2483
|
+
If the total width of all columns is less than the width of the
|
|
2484
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
2485
|
+
columns.
|
|
2486
|
+
|
|
2487
|
+
help : str or None
|
|
2062
2488
|
A tooltip that gets displayed when hovering over the column label. If
|
|
2063
2489
|
this is ``None`` (default), no tooltip is displayed.
|
|
2064
2490
|
|
|
@@ -2066,7 +2492,7 @@ def ProgressColumn(
|
|
|
2066
2492
|
the Markdown directives described in the ``body`` parameter of
|
|
2067
2493
|
``st.markdown``.
|
|
2068
2494
|
|
|
2069
|
-
format: str, "plain", "localized", "percent", "dollar", "euro", "yen", "accounting", "compact", "scientific", "engineering", or None
|
|
2495
|
+
format : str, "plain", "localized", "percent", "dollar", "euro", "yen", "accounting", "compact", "scientific", "engineering", or None
|
|
2070
2496
|
A format string controlling how the numbers are displayed.
|
|
2071
2497
|
This can be one of the following values:
|
|
2072
2498
|
|
|
@@ -2093,26 +2519,39 @@ def ProgressColumn(
|
|
|
2093
2519
|
number formatting from ``pandas.Styler``. The number formatting does
|
|
2094
2520
|
not impact the return value when used in ``st.data_editor``.
|
|
2095
2521
|
|
|
2096
|
-
pinned: bool or None
|
|
2522
|
+
pinned : bool or None
|
|
2097
2523
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
2098
2524
|
left side no matter where the user scrolls. If this is ``None``
|
|
2099
2525
|
(default), Streamlit will decide: index columns are pinned, and data
|
|
2100
2526
|
columns are not pinned.
|
|
2101
2527
|
|
|
2102
|
-
min_value: int, float, or None
|
|
2528
|
+
min_value : int, float, or None
|
|
2103
2529
|
The minimum value of the progress bar. If this is ``None`` (default),
|
|
2104
2530
|
the minimum will be 0.
|
|
2105
2531
|
|
|
2106
|
-
max_value: int, float, or None
|
|
2532
|
+
max_value : int, float, or None
|
|
2107
2533
|
The maximum value of the progress bar. If this is ``None`` (default),
|
|
2108
2534
|
the maximum will be 100 for integer values and 1.0 for float values.
|
|
2109
2535
|
|
|
2110
|
-
step: int, float, or None
|
|
2536
|
+
step : int, float, or None
|
|
2111
2537
|
The precision of numbers. If this is ``None`` (default), integer columns
|
|
2112
2538
|
will have a step of 1 and float columns will have a step of 0.01.
|
|
2113
2539
|
Setting ``step`` for float columns will ensure a consistent number of
|
|
2114
2540
|
digits after the decimal are displayed.
|
|
2115
2541
|
|
|
2542
|
+
color : "auto", "auto-inverse", str, or None
|
|
2543
|
+
The color to use for the chart. This can be one of the following:
|
|
2544
|
+
|
|
2545
|
+
- ``None`` (default): The primary color is used.
|
|
2546
|
+
- ``"auto"``: If the value is more than half, the bar is green; if the
|
|
2547
|
+
value is less than half, the bar is red.
|
|
2548
|
+
- ``"auto-inverse"``: If the value is more than half, the bar is red;
|
|
2549
|
+
if the value is less than half, the bar is green.
|
|
2550
|
+
- A single color value that is applied to all charts in the column.
|
|
2551
|
+
In addition to the basic color palette (red, orange, yellow, green,
|
|
2552
|
+
blue, violet, gray/grey, and primary), this supports hex codes like
|
|
2553
|
+
``"#483d8b"``.
|
|
2554
|
+
|
|
2116
2555
|
Examples
|
|
2117
2556
|
--------
|
|
2118
2557
|
>>> import pandas as pd
|
|
@@ -2143,6 +2582,9 @@ def ProgressColumn(
|
|
|
2143
2582
|
height: 300px
|
|
2144
2583
|
""" # noqa: E501
|
|
2145
2584
|
|
|
2585
|
+
if color is not None:
|
|
2586
|
+
_validate_chart_color(color)
|
|
2587
|
+
|
|
2146
2588
|
return ColumnConfig(
|
|
2147
2589
|
label=label,
|
|
2148
2590
|
width=width,
|
|
@@ -2154,6 +2596,7 @@ def ProgressColumn(
|
|
|
2154
2596
|
min_value=min_value,
|
|
2155
2597
|
max_value=max_value,
|
|
2156
2598
|
step=step,
|
|
2599
|
+
color=color,
|
|
2157
2600
|
),
|
|
2158
2601
|
)
|
|
2159
2602
|
|
|
@@ -2174,11 +2617,11 @@ def JsonColumn(
|
|
|
2174
2617
|
|
|
2175
2618
|
Parameters
|
|
2176
2619
|
----------
|
|
2177
|
-
label: str or None
|
|
2620
|
+
label : str or None
|
|
2178
2621
|
The label shown at the top of the column. If this is ``None``
|
|
2179
2622
|
(default), the column name is used.
|
|
2180
2623
|
|
|
2181
|
-
width: "small", "medium", "large", int, or None
|
|
2624
|
+
width : "small", "medium", "large", int, or None
|
|
2182
2625
|
The display width of the column. If this is ``None`` (default), the
|
|
2183
2626
|
column will be sized to fit the cell contents. Otherwise, this can be
|
|
2184
2627
|
one of the following:
|
|
@@ -2188,7 +2631,11 @@ def JsonColumn(
|
|
|
2188
2631
|
- ``"large"``: 400px wide
|
|
2189
2632
|
- An integer specifying the width in pixels
|
|
2190
2633
|
|
|
2191
|
-
|
|
2634
|
+
If the total width of all columns is less than the width of the
|
|
2635
|
+
dataframe, the remaining space will be distributed evenly among all
|
|
2636
|
+
columns.
|
|
2637
|
+
|
|
2638
|
+
help : str or None
|
|
2192
2639
|
A tooltip that gets displayed when hovering over the column label. If
|
|
2193
2640
|
this is ``None`` (default), no tooltip is displayed.
|
|
2194
2641
|
|
|
@@ -2196,7 +2643,7 @@ def JsonColumn(
|
|
|
2196
2643
|
the Markdown directives described in the ``body`` parameter of
|
|
2197
2644
|
``st.markdown``.
|
|
2198
2645
|
|
|
2199
|
-
pinned: bool or None
|
|
2646
|
+
pinned : bool or None
|
|
2200
2647
|
Whether the column is pinned. A pinned column will stay visible on the
|
|
2201
2648
|
left side no matter where the user scrolls. If this is ``None``
|
|
2202
2649
|
(default), Streamlit will decide: index columns are pinned, and data
|