@@ -257,39 +257,39 @@ def AppLayout(
257
257
use_drawer = True
258
258
title = t .use_title_get () or title
259
259
children_appbartitle = apptitle_portal .use_portal ()
260
- show_app_bar = (title and (len (routes ) > 1 and navigation )) or children_appbar or use_drawer or children_appbartitle
261
-
262
- if style is None :
263
- style = {"height" : "100%" , "max-height" : "100%" , "overflow" : "auto" }
264
- # if style is None, we choose a default style based on whether we are seeing the appbar, etc
265
- if show_app_bar or children_sidebar or len (children ) != 1 :
266
- style ["padding" ] = "12px"
267
260
268
261
def set_path (index ):
269
262
path = paths [index ]
270
263
location .pathname = path
271
264
272
265
v_slots = []
273
-
266
+ # Separate tabs from the other children. We want to keep a reference to any tabs that were added through children
267
+ # so we can make sure AppBar is rendered even when tabs are the only children
274
268
tabs = None
275
269
for child_appbar in children_appbar .copy ():
276
270
if child_appbar .component == solara .lab .Tabs :
277
271
if tabs is not None :
278
272
raise ValueError ("Only one Tabs component is allowed in the AppBar" )
279
273
tabs = child_appbar
280
274
children_appbar .remove (tabs )
275
+ tabs_to_render = tabs
276
+
277
+ show_app_bar = (title and (len (routes ) > 1 and navigation )) or bool (children_appbar ) or bool (use_drawer ) or bool (children_appbartitle ) or bool (tabs )
281
278
282
- if (tabs is None ) and routes and navigation and (len (routes ) > 1 ):
283
- with solara .lab .Tabs (value = index , on_value = set_path , align = "center" ) as tabs :
279
+ if style is None :
280
+ style = {"height" : "100%" , "max-height" : "100%" , "overflow" : "auto" }
281
+ # if style is None, we choose a default style based on whether we are seeing the appbar, etc
282
+ if show_app_bar or children_sidebar or len (children ) != 1 :
283
+ style ["padding" ] = "12px"
284
+
285
+ if (tabs_to_render is None ) and routes and navigation and (len (routes ) > 1 ):
286
+ with solara .lab .Tabs (value = index , on_value = set_path , align = "center" ) as tabs_to_render :
284
287
for route in routes :
285
288
name = route .path if route .path != "/" else "Home"
286
289
solara .lab .Tab (name )
287
- # with v.Tabs(v_model=index, on_v_model=set_path, centered=True) as tabs:
288
- # for route in routes:
289
- # name = route.path if route.path != "/" else "Home"
290
- # v.Tab(children=[name])
291
- if tabs is not None :
292
- v_slots = [{"name" : "extension" , "children" : tabs }]
290
+
291
+ if tabs_to_render is not None and navigation :
292
+ v_slots = [{"name" : "extension" , "children" : tabs_to_render }]
293
293
if embedded_mode and not fullscreen :
294
294
# this version doesn't need to run fullscreen
295
295
# also ideal in jupyter notebooks
0 commit comments