Open PaulC91 opened 1 year ago
bslib will automatically expand the local sidebar layout to full-width in a navbar panel when
fillable = TRUE
for that panel, andlayout_sidebar()
is the only child.Using an example from the linked layout article, the Diamonds panel will have a local, full-width/height sidebar layout:
page_navbar(
title = "Sidebar demo",
fillable = TRUE,
nav_panel("Earthquakes", sidebar_quakes),
nav_panel(
"Diamonds",
layout_sidebar(
sidebar = sidebar(filters[[1]]),
plots[[1]]
)
)
)
Notice that I changed fillable
from fillable = "Earthquakes"
to fillable = TRUE
so that all panels in this navbar page are fillable. I also reduced the diamonds panel to a single layout_sidebar()
– the example in the article has three of these layouts.
Are you wanting to have three sidebar layouts on the same page but have all three be the width of the browser window? If so, that's not well supported in bslib and you'd likely have to write some custom CSS to achieve that layout.
Hey thanks for the response. I'm not getting the desired result following the 2 conditions you mentioned:
library(shiny)
library(bslib)
ui <- page_navbar(
title = "Sidebar demo",
fillable = TRUE,
nav_panel(
"Earthquakes",
layout_sidebar(
sidebar = sidebar(title = "Sidebar"),
"Test"
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
Are you using Firefox by chance? (If not, which browser are you testing in?) We're using the :has()
selector to make this work, which isn't quite supported in Firefox yet. I apologize for not mentioning that earlier.
Ahh yes I am! OK no problem I can wait for the firefox support :) Thanks for your time looking into it.
Hi there.
Firstly many thanks for all the great progress on bslib. I really like the option of being able to have various page layouts within a
page_navbar
including some with sidebars and some without.However, as you can currently see on your Multi-page varied layout example, when a
layout_sidebar
is provided as the root UI element of anav_panel
inside apage_navbar
there is a noticeable amount of padding around it. I don't think this is desirable as sidebar layouts should ideally be flush to the edges of the page, like they are when a global sidebar is set inpage_navbar
.Is there an easy workaround to achieve this or is possible to make this the default behaviour in the package?
Thanks!