Skip to content

Conversation

@gadenbuie
Copy link
Member

Fixes two issues with layout_columns():

  1. col_widths = c(12, 6, 6) now becomes col_widths = breakpoints(sm = c(12, 6, 6)) where we previously used md as the default breakpoint. This update aligns with the intuitive expectation that col_widths of a single value is the column widths at all breakpoints (except mobile where we do something completely different).

  2. While here I noticed that we actually do need to include the xs-specific CSS variable when it's not the only variable being set. Without this change the row_heights = breakpoints(xs = ..., sm = ...) doesn't work as expected.

Example app

library(shiny)
# library(bslib)
pkgload::load_all()

ui <- page_fillable(
  layout_columns(
    col_widths = c(12, 6, 6),
    row_heights = breakpoints(
      xs = c(7, 1.5, 1.5),
      sm = c(70, 30)
    ),
    card("Chart 1"),
    navset_card_tab(
      nav_panel("Chart 2"),
      nav_panel("Chart 3")
    ),
    card("Chart 4")
  )
)

server <- function(input, output, session) {

}

shinyApp(ui, server)

Current behavior on shinylive.io.

Co-authored-by: Carson Sievert <[email protected]>
@gadenbuie gadenbuie merged commit 2ec3067 into main Mar 19, 2024
@gadenbuie gadenbuie deleted the layout-columns/default-breakpoint branch March 19, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants