streamlit-nightly 1.33.1.dev20240430__py2.py3-none-any.whl → 1.33.1.dev20240501__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamlit/commands/page_config.py +34 -6
- streamlit/elements/alert.py +64 -20
- streamlit/elements/dialog_decorator.py +56 -31
- streamlit/elements/empty.py +3 -3
- streamlit/elements/form.py +2 -2
- streamlit/elements/heading.py +9 -3
- streamlit/elements/layouts.py +31 -23
- streamlit/elements/lib/column_types.py +3 -1
- streamlit/elements/markdown.py +8 -4
- streamlit/elements/media.py +12 -12
- streamlit/elements/metric.py +3 -1
- streamlit/elements/progress.py +3 -1
- streamlit/elements/toast.py +20 -6
- streamlit/elements/widgets/button.py +22 -14
- streamlit/elements/widgets/camera_input.py +3 -1
- streamlit/elements/widgets/chat.py +26 -9
- streamlit/elements/widgets/checkbox.py +10 -6
- streamlit/elements/widgets/color_picker.py +5 -3
- streamlit/elements/widgets/file_uploader.py +4 -2
- streamlit/elements/widgets/multiselect.py +7 -5
- streamlit/elements/widgets/number_input.py +6 -4
- streamlit/elements/widgets/radio.py +6 -4
- streamlit/elements/widgets/select_slider.py +10 -8
- streamlit/elements/widgets/selectbox.py +8 -6
- streamlit/elements/widgets/slider.py +11 -9
- streamlit/elements/widgets/text_widgets.py +9 -5
- streamlit/elements/widgets/time_widgets.py +13 -9
- streamlit/runtime/caching/cache_utils.py +34 -3
- streamlit/runtime/state/query_params_proxy.py +23 -13
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/METADATA +1 -1
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/RECORD +35 -35
- {streamlit_nightly-1.33.1.dev20240430.data → streamlit_nightly-1.33.1.dev20240501.data}/scripts/streamlit.cmd +0 -0
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/WHEEL +0 -0
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/entry_points.txt +0 -0
- {streamlit_nightly-1.33.1.dev20240430.dist-info → streamlit_nightly-1.33.1.dev20240501.dist-info}/top_level.txt +0 -0
@@ -136,22 +136,50 @@ def set_page_config(
|
|
136
136
|
page_title: str or None
|
137
137
|
The page title, shown in the browser tab. If None, defaults to the
|
138
138
|
filename of the script ("app.py" would show "app • Streamlit").
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
139
|
+
|
140
|
+
page_icon : Anything supported by st.image, str, or None
|
141
|
+
The page favicon. If ``page_icon`` is ``None`` (default), the favicon
|
142
|
+
will be a monochrome Streamlit logo.
|
143
|
+
|
144
|
+
In addition to the types supported by ``st.image`` (like URLs or numpy
|
145
|
+
arrays), the following strings are valid:
|
146
|
+
|
147
|
+
* A single-character emoji. For example, you can set ``page_icon="🦈"``.
|
148
|
+
|
149
|
+
* An emoji short code. For example, you can set ``page_icon=":shark:"``.
|
150
|
+
For a list of all supported codes, see
|
151
|
+
https://share.streamlit.io/streamlit/emoji-shortcodes.
|
152
|
+
|
153
|
+
* The string literal, ``"random"``. You can set ``page_icon="random"``
|
154
|
+
to set a random emoji from the supported list above. Emoji icons are
|
155
|
+
courtesy of Twemoji and loaded from MaxCDN.
|
156
|
+
|
157
|
+
* An icon from the Material Symbols library (outlined style) in the
|
158
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
159
|
+
of the icon in snake case.
|
160
|
+
|
161
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
162
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
163
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
164
|
+
font library.
|
165
|
+
|
166
|
+
.. note::
|
167
|
+
Colors are not supported for Material icons. When you use a
|
168
|
+
Material icon for favicon, it will be black, regardless of browser
|
169
|
+
theme.
|
170
|
+
|
145
171
|
layout: "centered" or "wide"
|
146
172
|
How the page content should be laid out. Defaults to "centered",
|
147
173
|
which constrains the elements into a centered column of fixed width;
|
148
174
|
"wide" uses the entire screen.
|
175
|
+
|
149
176
|
initial_sidebar_state: "auto", "expanded", or "collapsed"
|
150
177
|
How the sidebar should start out. Defaults to "auto",
|
151
178
|
which hides the sidebar on small devices and shows it otherwise.
|
152
179
|
"expanded" shows the sidebar initially; "collapsed" hides it.
|
153
180
|
In most cases, you should just use "auto", otherwise the app will
|
154
181
|
look bad when embedded and viewed on mobile.
|
182
|
+
|
155
183
|
menu_items: dict
|
156
184
|
Configure the menu that appears on the top-right side of this app.
|
157
185
|
The keys in this dict denote the menu item you'd like to configure:
|
streamlit/elements/alert.py
CHANGED
@@ -39,11 +39,22 @@ class AlertMixin:
|
|
39
39
|
----------
|
40
40
|
body : str
|
41
41
|
The error text to display.
|
42
|
-
icon : str
|
43
|
-
An optional
|
44
|
-
|
45
|
-
|
46
|
-
|
42
|
+
icon : str, None
|
43
|
+
An optional emoji or icon to display next to the alert. If ``icon``
|
44
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
45
|
+
string, the following options are valid:
|
46
|
+
|
47
|
+
* A single-character emoji. For example, you can set ``icon="🚨"``
|
48
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
49
|
+
|
50
|
+
* An icon from the Material Symbols library (outlined style) in the
|
51
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
52
|
+
of the icon in snake case.
|
53
|
+
|
54
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
55
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
56
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
57
|
+
font library.
|
47
58
|
|
48
59
|
Example
|
49
60
|
-------
|
@@ -72,11 +83,22 @@ class AlertMixin:
|
|
72
83
|
----------
|
73
84
|
body : str
|
74
85
|
The warning text to display.
|
75
|
-
icon : str
|
76
|
-
An optional
|
77
|
-
|
78
|
-
|
79
|
-
|
86
|
+
icon : str, None
|
87
|
+
An optional emoji or icon to display next to the alert. If ``icon``
|
88
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
89
|
+
string, the following options are valid:
|
90
|
+
|
91
|
+
* A single-character emoji. For example, you can set ``icon="🚨"``
|
92
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
93
|
+
|
94
|
+
* An icon from the Material Symbols library (outlined style) in the
|
95
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
96
|
+
of the icon in snake case.
|
97
|
+
|
98
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
99
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
100
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
101
|
+
font library.
|
80
102
|
|
81
103
|
Example
|
82
104
|
-------
|
@@ -104,11 +126,22 @@ class AlertMixin:
|
|
104
126
|
----------
|
105
127
|
body : str
|
106
128
|
The info text to display.
|
107
|
-
icon : str
|
108
|
-
An optional
|
109
|
-
|
110
|
-
|
111
|
-
|
129
|
+
icon : str, None
|
130
|
+
An optional emoji or icon to display next to the alert. If ``icon``
|
131
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
132
|
+
string, the following options are valid:
|
133
|
+
|
134
|
+
* A single-character emoji. For example, you can set ``icon="🚨"``
|
135
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
136
|
+
|
137
|
+
* An icon from the Material Symbols library (outlined style) in the
|
138
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
139
|
+
of the icon in snake case.
|
140
|
+
|
141
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
142
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
143
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
144
|
+
font library.
|
112
145
|
|
113
146
|
Example
|
114
147
|
-------
|
@@ -137,11 +170,22 @@ class AlertMixin:
|
|
137
170
|
----------
|
138
171
|
body : str
|
139
172
|
The success text to display.
|
140
|
-
icon : str
|
141
|
-
An optional
|
142
|
-
|
143
|
-
|
144
|
-
|
173
|
+
icon : str, None
|
174
|
+
An optional emoji or icon to display next to the alert. If ``icon``
|
175
|
+
is ``None`` (default), no icon is displayed. If ``icon`` is a
|
176
|
+
string, the following options are valid:
|
177
|
+
|
178
|
+
* A single-character emoji. For example, you can set ``icon="🚨"``
|
179
|
+
or ``icon="🔥"``. Emoji short codes are not supported.
|
180
|
+
|
181
|
+
* An icon from the Material Symbols library (outlined style) in the
|
182
|
+
format ``":material/icon_name:"`` where "icon_name" is the name
|
183
|
+
of the icon in snake case.
|
184
|
+
|
185
|
+
For example, ``icon=":material/thumb_up:"`` will display the
|
186
|
+
Thumb Up icon. Find additional icons in the `Material Symbols \
|
187
|
+
<https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined>`_
|
188
|
+
font library.
|
145
189
|
|
146
190
|
Example
|
147
191
|
-------
|
@@ -94,56 +94,81 @@ def dialog_decorator(title: F | None, *, width: DialogWidth = "small") -> F:
|
|
94
94
|
def dialog_decorator(
|
95
95
|
title: F | None | str = "", *, width: DialogWidth = "small"
|
96
96
|
) -> F | Callable[[F], F]:
|
97
|
-
|
97
|
+
"""Function decorator to create a modal dialog.
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
A function decorated with ``@st.experimental_dialog`` becomes a dialog
|
100
|
+
function. When you call a dialog function, Streamlit inserts a modal dialog
|
101
|
+
into your app. Streamlit element commands called within the dialog function
|
102
|
+
render inside the modal dialog.
|
102
103
|
|
103
|
-
The
|
104
|
+
The dialog function can accept arguments that can be passed when it is
|
105
|
+
called. Any values from the dialog that need to be accessed from the wider
|
106
|
+
app should generally be stored in Session State.
|
104
107
|
|
105
|
-
|
106
|
-
|
108
|
+
A user can dismiss a modal dialog by clicking outside of it, clicking the
|
109
|
+
"**X**" in its upper-right corner, or pressing``ESC`` on their keyboard.
|
110
|
+
Dismissing a modal dialog does not trigger an app rerun. To close the modal
|
111
|
+
dialog programmatically, call ``st.rerun()`` explicitly inside of the
|
112
|
+
dialog function.
|
107
113
|
|
108
|
-
|
114
|
+
``st.experimental_dialog`` inherits behavior from |st.experimental_fragment|_.
|
115
|
+
When a user interacts with an input widget created inside a dialog function,
|
116
|
+
Streamlit only reruns the dialog function instead of the full script.
|
117
|
+
|
118
|
+
Calling ``st.sidebar`` in a dialog function is not supported.
|
119
|
+
|
120
|
+
Dialog code can interact with Session State, imported modules, and other
|
121
|
+
Streamlit elements created outside the dialog. Note that these interactions
|
122
|
+
are additive across multiple dialog reruns. You are responsible for
|
123
|
+
handling any side effects of that behavior.
|
109
124
|
|
110
125
|
.. warning::
|
111
|
-
|
112
|
-
|
126
|
+
A dialog may not open another dialog. Only one dialog function may be
|
127
|
+
called in a script run, which means that only one dialog can be open at
|
128
|
+
any given time.
|
129
|
+
|
130
|
+
.. |st.experimental_fragment| replace:: ``st.experimental_fragment``
|
131
|
+
.. _st.experimental_fragment: https://docs.streamlit.io/develop/api-reference/execution-flow/st.fragment
|
113
132
|
|
114
133
|
Parameters
|
115
134
|
----------
|
116
135
|
title : str
|
117
|
-
|
136
|
+
The title to display at the top of the modal dialog. It cannot be empty.
|
118
137
|
width : "small", "large"
|
119
|
-
The width of the dialog.
|
120
|
-
|
121
|
-
|
122
|
-
-------
|
123
|
-
A decorated function that, when called, inserts a dialog element context container. The container itself contains the decorated function's elements.
|
138
|
+
The width of the modal dialog. If ``width`` is ``"small`` (default), the
|
139
|
+
modal dialog will be 500 pixels wide. If ``width`` is ``"large"``, the
|
140
|
+
modal dialog will be about 750 pixels wide.
|
124
141
|
|
125
142
|
Examples
|
126
143
|
--------
|
127
|
-
|
128
|
-
|
144
|
+
The following example demonstrates the basic usage of ``@st.experimental_dialog``.
|
145
|
+
In this app, clicking "**A**" or "**B**" will open a modal dialog and prompt you
|
146
|
+
to enter a reason for your vote. In the modal dialog, click "**Submit**" to record
|
147
|
+
your vote into Session State and rerun the app. This will close the modal dialog
|
148
|
+
since the dialog function is not called during the full-script rerun.
|
129
149
|
|
130
150
|
>>> import streamlit as st
|
131
151
|
>>>
|
132
|
-
>>> @st.experimental_dialog("
|
133
|
-
>>> def
|
134
|
-
>>> st.write(f"
|
135
|
-
>>>
|
136
|
-
>>>
|
137
|
-
>>>
|
138
|
-
>>> st.write(f"You wrote '{some_text_input}' in the dialog")
|
139
|
-
>>> if st.button("Close the dialog"):
|
152
|
+
>>> @st.experimental_dialog("Cast your vote")
|
153
|
+
>>> def vote(item):
|
154
|
+
>>> st.write(f"Why is {item} your favorite?")
|
155
|
+
>>> reason = st.text_input("Because...")
|
156
|
+
>>> if st.button("Submit"):
|
157
|
+
>>> st.session_state.vote = {"item": item, "reason": reason}
|
140
158
|
>>> st.rerun()
|
141
159
|
>>>
|
142
|
-
>>> if st.
|
143
|
-
>>>
|
144
|
-
>>>
|
145
|
-
>>>
|
146
|
-
>>> st.
|
160
|
+
>>> if "vote" not in st.session_state:
|
161
|
+
>>> st.write("Vote for your favorite")
|
162
|
+
>>> if st.button("A"):
|
163
|
+
>>> vote("A")
|
164
|
+
>>> if st.button("B"):
|
165
|
+
>>> vote("B")
|
166
|
+
>>> else:
|
167
|
+
>>> f"You voted for {st.session_state.vote['item']} because {st.session_state.vote['reason']}"
|
168
|
+
|
169
|
+
.. output::
|
170
|
+
https://doc-dialog.streamlit.app/
|
171
|
+
height: 350px
|
147
172
|
|
148
173
|
"""
|
149
174
|
|
streamlit/elements/empty.py
CHANGED
@@ -33,12 +33,12 @@ class EmptyMixin:
|
|
33
33
|
several elements at once (using a child multi-element container).
|
34
34
|
|
35
35
|
To insert/replace/clear an element on the returned container, you can
|
36
|
-
use
|
36
|
+
use ``with`` notation or just call methods directly on the returned object.
|
37
37
|
See examples below.
|
38
38
|
|
39
39
|
Examples
|
40
40
|
--------
|
41
|
-
Overwriting elements in-place using
|
41
|
+
Overwriting elements in-place using ``with`` notation:
|
42
42
|
|
43
43
|
>>> import streamlit as st
|
44
44
|
>>> import time
|
@@ -82,7 +82,7 @@ class EmptyMixin:
|
|
82
82
|
several elements at once (using a child multi-element container).
|
83
83
|
|
84
84
|
To insert/replace/clear an element on the returned container, you can
|
85
|
-
use
|
85
|
+
use ``with`` notation or just call methods directly on the returned object.
|
86
86
|
See some of the examples below.
|
87
87
|
|
88
88
|
This is an internal method and should not be used directly.
|
streamlit/elements/form.py
CHANGED
@@ -123,7 +123,7 @@ class FormMixin:
|
|
123
123
|
Submit button is pressed, all widget values inside the form will be
|
124
124
|
sent to Streamlit in a batch.
|
125
125
|
|
126
|
-
To add elements to a form object, you can use
|
126
|
+
To add elements to a form object, you can use ``with`` notation
|
127
127
|
(preferred) or just call methods directly on the form. See
|
128
128
|
examples below.
|
129
129
|
|
@@ -157,7 +157,7 @@ class FormMixin:
|
|
157
157
|
|
158
158
|
Examples
|
159
159
|
--------
|
160
|
-
Inserting elements using
|
160
|
+
Inserting elements using ``with`` notation:
|
161
161
|
|
162
162
|
>>> import streamlit as st
|
163
163
|
>>>
|
streamlit/elements/heading.py
CHANGED
@@ -69,8 +69,10 @@ class HeadingMixin:
|
|
69
69
|
|
70
70
|
* Colored text and background colors for text, using the syntax
|
71
71
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
72
|
-
respectively
|
72
|
+
respectively. ``color`` must be replaced with any of the following
|
73
73
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
74
|
+
For example, you can use ``:orange[your text here]`` or
|
75
|
+
``:blue-background[your text here]``.
|
74
76
|
|
75
77
|
anchor : str or False
|
76
78
|
The anchor name of the header that can be accessed with #anchor
|
@@ -140,8 +142,10 @@ class HeadingMixin:
|
|
140
142
|
|
141
143
|
* Colored text and background colors for text, using the syntax
|
142
144
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
143
|
-
respectively
|
145
|
+
respectively. ``color`` must be replaced with any of the following
|
144
146
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
147
|
+
For example, you can use ``:orange[your text here]`` or
|
148
|
+
``:blue-background[your text here]``.
|
145
149
|
|
146
150
|
anchor : str or False
|
147
151
|
The anchor name of the header that can be accessed with #anchor
|
@@ -213,8 +217,10 @@ class HeadingMixin:
|
|
213
217
|
|
214
218
|
* Colored text and background colors for text, using the syntax
|
215
219
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
216
|
-
respectively
|
220
|
+
respectively. ``color`` must be replaced with any of the following
|
217
221
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
222
|
+
For example, you can use ``:orange[your text here]`` or
|
223
|
+
``:blue-background[your text here]``.
|
218
224
|
|
219
225
|
anchor : str or False
|
220
226
|
The anchor name of the header that can be accessed with #anchor
|
streamlit/elements/layouts.py
CHANGED
@@ -41,7 +41,7 @@ class LayoutsMixin:
|
|
41
41
|
multiple elements. This allows you to, for example, insert multiple
|
42
42
|
elements into your app out of order.
|
43
43
|
|
44
|
-
To add elements to the returned container, you can use the
|
44
|
+
To add elements to the returned container, you can use the ``with`` notation
|
45
45
|
(preferred) or just call methods directly on the returned object. See
|
46
46
|
examples below.
|
47
47
|
|
@@ -67,7 +67,7 @@ class LayoutsMixin:
|
|
67
67
|
|
68
68
|
Examples
|
69
69
|
--------
|
70
|
-
Inserting elements using
|
70
|
+
Inserting elements using ``with`` notation:
|
71
71
|
|
72
72
|
>>> import streamlit as st
|
73
73
|
>>>
|
@@ -151,7 +151,7 @@ class LayoutsMixin:
|
|
151
151
|
Inserts a number of multi-element containers laid out side-by-side and
|
152
152
|
returns a list of container objects.
|
153
153
|
|
154
|
-
To add elements to the returned containers, you can use the
|
154
|
+
To add elements to the returned containers, you can use the ``with`` notation
|
155
155
|
(preferred) or just call methods directly on the returned object. See
|
156
156
|
examples below.
|
157
157
|
|
@@ -183,7 +183,7 @@ class LayoutsMixin:
|
|
183
183
|
|
184
184
|
Examples
|
185
185
|
--------
|
186
|
-
You can use the
|
186
|
+
You can use the ``with`` notation to insert any element into a column:
|
187
187
|
|
188
188
|
>>> import streamlit as st
|
189
189
|
>>>
|
@@ -277,7 +277,7 @@ class LayoutsMixin:
|
|
277
277
|
Tabs are a navigational element that allows users to easily
|
278
278
|
move between groups of related content.
|
279
279
|
|
280
|
-
To add elements to the returned containers, you can use the
|
280
|
+
To add elements to the returned containers, you can use the ``with`` notation
|
281
281
|
(preferred) or just call methods directly on the returned object. See
|
282
282
|
examples below.
|
283
283
|
|
@@ -305,8 +305,10 @@ class LayoutsMixin:
|
|
305
305
|
|
306
306
|
* Colored text and background colors for text, using the syntax
|
307
307
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
308
|
-
respectively
|
308
|
+
respectively. ``color`` must be replaced with any of the following
|
309
309
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
310
|
+
For example, you can use ``:orange[your text here]`` or
|
311
|
+
``:blue-background[your text here]``.
|
310
312
|
|
311
313
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
312
314
|
Display unsupported elements as literal characters by
|
@@ -319,7 +321,7 @@ class LayoutsMixin:
|
|
319
321
|
|
320
322
|
Examples
|
321
323
|
--------
|
322
|
-
You can use the
|
324
|
+
You can use the ``with`` notation to insert any element into a tab:
|
323
325
|
|
324
326
|
>>> import streamlit as st
|
325
327
|
>>>
|
@@ -390,7 +392,7 @@ class LayoutsMixin:
|
|
390
392
|
and can be expanded or collapsed by the user. When collapsed, all that is
|
391
393
|
visible is the provided label.
|
392
394
|
|
393
|
-
To add elements to the returned container, you can use the
|
395
|
+
To add elements to the returned container, you can use the ``with`` notation
|
394
396
|
(preferred) or just call methods directly on the returned object. See
|
395
397
|
examples below.
|
396
398
|
|
@@ -416,8 +418,10 @@ class LayoutsMixin:
|
|
416
418
|
|
417
419
|
* Colored text and background colors for text, using the syntax
|
418
420
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
419
|
-
respectively
|
421
|
+
respectively. ``color`` must be replaced with any of the following
|
420
422
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
423
|
+
For example, you can use ``:orange[your text here]`` or
|
424
|
+
``:blue-background[your text here]``.
|
421
425
|
|
422
426
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
423
427
|
Display unsupported elements as literal characters by
|
@@ -428,18 +432,18 @@ class LayoutsMixin:
|
|
428
432
|
|
429
433
|
Examples
|
430
434
|
--------
|
431
|
-
You can use the
|
435
|
+
You can use the ``with`` notation to insert any element into an expander
|
432
436
|
|
433
437
|
>>> import streamlit as st
|
434
438
|
>>>
|
435
439
|
>>> st.bar_chart({"data": [1, 5, 2, 6, 2, 1]})
|
436
440
|
>>>
|
437
441
|
>>> with st.expander("See explanation"):
|
438
|
-
... st.write(
|
442
|
+
... st.write('''
|
439
443
|
... The chart above shows some numbers I picked for you.
|
440
444
|
... I rolled actual dice for these, so they're *guaranteed* to
|
441
445
|
... be random.
|
442
|
-
...
|
446
|
+
... ''')
|
443
447
|
... st.image("https://static.streamlit.io/examples/dice.jpg")
|
444
448
|
|
445
449
|
.. output ::
|
@@ -453,11 +457,11 @@ class LayoutsMixin:
|
|
453
457
|
>>> st.bar_chart({"data": [1, 5, 2, 6, 2, 1]})
|
454
458
|
>>>
|
455
459
|
>>> expander = st.expander("See explanation")
|
456
|
-
>>> expander.write(
|
460
|
+
>>> expander.write('''
|
457
461
|
... The chart above shows some numbers I picked for you.
|
458
462
|
... I rolled actual dice for these, so they're *guaranteed* to
|
459
463
|
... be random.
|
460
|
-
...
|
464
|
+
... ''')
|
461
465
|
>>> expander.image("https://static.streamlit.io/examples/dice.jpg")
|
462
466
|
|
463
467
|
.. output ::
|
@@ -523,8 +527,10 @@ class LayoutsMixin:
|
|
523
527
|
|
524
528
|
* Colored text and background colors for text, using the syntax
|
525
529
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
526
|
-
respectively
|
530
|
+
respectively. ``color`` must be replaced with any of the following
|
527
531
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
532
|
+
For example, you can use ``:orange[your text here]`` or
|
533
|
+
``:blue-background[your text here]``.
|
528
534
|
|
529
535
|
Unsupported elements are unwrapped so only their children (text contents) render.
|
530
536
|
Display unsupported elements as literal characters by
|
@@ -545,7 +551,7 @@ class LayoutsMixin:
|
|
545
551
|
|
546
552
|
Examples
|
547
553
|
--------
|
548
|
-
You can use the
|
554
|
+
You can use the ``with`` notation to insert any element into a popover:
|
549
555
|
|
550
556
|
>>> import streamlit as st
|
551
557
|
>>>
|
@@ -609,11 +615,11 @@ class LayoutsMixin:
|
|
609
615
|
|
610
616
|
The label, state, and expanded state can all be updated by calling ``.update()``
|
611
617
|
on the returned object. To add elements to the returned container, you can
|
612
|
-
use
|
618
|
+
use ``with`` notation (preferred) or just call methods directly on the returned
|
613
619
|
object.
|
614
620
|
|
615
621
|
By default, ``st.status()`` initializes in the "running" state. When called using
|
616
|
-
|
622
|
+
``with`` notation, it automatically updates to the "complete" state at the end
|
617
623
|
of the "with" block. See examples below for more details.
|
618
624
|
|
619
625
|
Parameters
|
@@ -636,8 +642,10 @@ class LayoutsMixin:
|
|
636
642
|
|
637
643
|
* Colored text and background colors for text, using the syntax
|
638
644
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
639
|
-
respectively
|
645
|
+
respectively. ``color`` must be replaced with any of the following
|
640
646
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
647
|
+
For example, you can use ``:orange[your text here]`` or
|
648
|
+
``:blue-background[your text here]``.
|
641
649
|
|
642
650
|
Unsupported elements are unwrapped so only their children (text contents)
|
643
651
|
render. Display unsupported elements as literal characters by
|
@@ -667,7 +675,7 @@ class LayoutsMixin:
|
|
667
675
|
Examples
|
668
676
|
--------
|
669
677
|
|
670
|
-
You can use the
|
678
|
+
You can use the ``with`` notation to insert any element into an status container:
|
671
679
|
|
672
680
|
>>> import time
|
673
681
|
>>> import streamlit as st
|
@@ -680,13 +688,13 @@ class LayoutsMixin:
|
|
680
688
|
... st.write("Downloading data...")
|
681
689
|
... time.sleep(1)
|
682
690
|
>>>
|
683
|
-
>>> st.button(
|
691
|
+
>>> st.button("Rerun")
|
684
692
|
|
685
693
|
.. output ::
|
686
694
|
https://doc-status.streamlit.app/
|
687
695
|
height: 300px
|
688
696
|
|
689
|
-
You can also use
|
697
|
+
You can also use ``.update()`` on the container to change the label, state,
|
690
698
|
or expanded state:
|
691
699
|
|
692
700
|
>>> import time
|
@@ -701,7 +709,7 @@ class LayoutsMixin:
|
|
701
709
|
... time.sleep(1)
|
702
710
|
... status.update(label="Download complete!", state="complete", expanded=False)
|
703
711
|
>>>
|
704
|
-
>>> st.button(
|
712
|
+
>>> st.button("Rerun")
|
705
713
|
|
706
714
|
.. output ::
|
707
715
|
https://doc-status-update.streamlit.app/
|
@@ -533,7 +533,9 @@ def LinkColumn(
|
|
533
533
|
|
534
534
|
* A regular expression (JS flavor, detected by usage of parentheses)
|
535
535
|
to extract a part of the URL via a capture group, e.g. ``"https://(.*?)\\.example\\.com"``
|
536
|
-
to extract the display text "foo" from the URL "https://foo.example.com".
|
536
|
+
to extract the display text "foo" from the URL "\\https://foo.example.com".
|
537
|
+
|
538
|
+
.. Comment: The backslash in front of foo.example.com prevents a hyperlink.
|
537
539
|
|
538
540
|
For more complex cases, you may use `Pandas Styler's format \
|
539
541
|
<https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.format.html>`_
|
streamlit/elements/markdown.py
CHANGED
@@ -58,8 +58,10 @@ class MarkdownMixin:
|
|
58
58
|
|
59
59
|
* Colored text and background colors for text, using the syntax
|
60
60
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
61
|
-
respectively
|
61
|
+
respectively. ``color`` must be replaced with any of the following
|
62
62
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
63
|
+
For example, you can use ``:orange[your text here]`` or
|
64
|
+
``:blue-background[your text here]``.
|
63
65
|
|
64
66
|
unsafe_allow_html : bool
|
65
67
|
By default, any HTML tags found in the body will be escaped and
|
@@ -82,7 +84,7 @@ class MarkdownMixin:
|
|
82
84
|
>>> st.markdown("*Streamlit* is **really** ***cool***.")
|
83
85
|
>>> st.markdown('''
|
84
86
|
... :red[Streamlit] :orange[can] :green[write] :blue[text] :violet[in]
|
85
|
-
... :gray[pretty] :rainbow[colors].''')
|
87
|
+
... :gray[pretty] :rainbow[colors] and :blue-background[highlight] text.''')
|
86
88
|
>>> st.markdown("Here's a bouquet —\
|
87
89
|
... :tulip::cherry_blossom::rose::hibiscus::sunflower::blossom:")
|
88
90
|
>>>
|
@@ -95,7 +97,7 @@ class MarkdownMixin:
|
|
95
97
|
|
96
98
|
.. output::
|
97
99
|
https://doc-markdown.streamlit.app/
|
98
|
-
height:
|
100
|
+
height: 350px
|
99
101
|
|
100
102
|
"""
|
101
103
|
markdown_proto = MarkdownProto()
|
@@ -177,8 +179,10 @@ class MarkdownMixin:
|
|
177
179
|
|
178
180
|
* Colored text and background colors for text, using the syntax
|
179
181
|
``:color[text to be colored]`` and ``:color-background[text to be colored]``,
|
180
|
-
respectively
|
182
|
+
respectively. ``color`` must be replaced with any of the following
|
181
183
|
supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
|
184
|
+
For example, you can use ``:orange[your text here]`` or
|
185
|
+
``:blue-background[your text here]``.
|
182
186
|
|
183
187
|
unsafe_allow_html : bool
|
184
188
|
By default, any HTML tags found in strings will be escaped and
|