@@ -1081,7 +1081,7 @@ def put_collapse(title, content=[], open=False, scope=None, position=OutputPosit
1081
1081
1082
1082
1083
1083
@safely_destruct_output_when_exp ('content' )
1084
- def put_scrollable (content = [], height = 400 , keep_bottom = False , horizon_scroll = False , border = True ,
1084
+ def put_scrollable (content = [], height = 400 , keep_bottom = False , border = True ,
1085
1085
scope = None , position = OutputPosition .BOTTOM , ** kwargs ) -> Output :
1086
1086
"""Output a fixed height content area. scroll bar is displayed when the content exceeds the limit
1087
1087
@@ -1090,8 +1090,8 @@ def put_scrollable(content=[], height=400, keep_bottom=False, horizon_scroll=Fal
1090
1090
:param int/tuple height: The height of the area (in pixels).
1091
1091
``height`` parameter also accepts ``(min_height, max_height)`` to indicate the range of height, for example,
1092
1092
``(100, 200)`` means that the area has a minimum height of 100 pixels and a maximum of 200 pixels.
1093
+ Set ``None`` if you don't want to limit the height
1093
1094
:param bool keep_bottom: Whether to keep the content area scrolled to the bottom when updated.
1094
- :param bool horizon_scroll: Whether to use the horizontal scroll bar
1095
1095
:param bool border: Whether to show border
1096
1096
:param int scope, position: Those arguments have the same meaning as for `put_text()`
1097
1097
@@ -1110,9 +1110,22 @@ def put_scrollable(content=[], height=400, keep_bottom=False, horizon_scroll=Fal
1110
1110
o.append(time.time())
1111
1111
time.sleep(0.5)
1112
1112
1113
+ You can use `put_scrollable()` to avoid page width exceeding screen width (especially in mobile device):
1114
+
1115
+ .. exportable-codeblock::
1116
+ :name: put_scrollable_2
1117
+ :summary: `put_scrollable()` usage
1118
+
1119
+ with put_scrollable(border=False, height=None):
1120
+ # use `white-space: nowrap` to disable line break
1121
+ put_text('long content ' * 20).style('white-space: nowrap')
1122
+
1113
1123
.. versionchanged:: 1.1
1114
1124
add ``height`` parameter,remove ``max_height`` parameter;
1115
1125
add ``keep_bottom`` parameter
1126
+
1127
+ .. versionchanged:: 1.5
1128
+ remove ``horizon_scroll`` parameter
1116
1129
"""
1117
1130
if not isinstance (content , (list , tuple , OutputList )):
1118
1131
content = [content ]
@@ -1131,9 +1144,8 @@ def put_scrollable(content=[], height=400, keep_bottom=False, horizon_scroll=Fal
1131
1144
min_height , max_height = height , height
1132
1145
1133
1146
spec = _get_output_spec ('scrollable' , contents = content , min_height = min_height , max_height = max_height ,
1134
- keep_bottom = keep_bottom , horizon_scroll = horizon_scroll , border = border , scope = scope ,
1135
- position = position )
1136
- return Output (spec )
1147
+ keep_bottom = keep_bottom , border = border , scope = scope , position = position )
1148
+ return Output (spec ).enable_context_manager (container_selector = '> div' )
1137
1149
1138
1150
1139
1151
@safely_destruct_output_when_exp ('tabs' )
0 commit comments