Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

* `layout_sidebar()` now uses an `<aside>` element for the sidebar's container and a `<header>` element for the sidebar title. The classes of each element remain the same, but the semantic meaning of the elements is now better reflected in the HTML markup. (#580)

* In `layout_column_wrap()`, when `width` is a CSS unit -- e.g. `width = "400px"` or `width = "25%"` -- and `fixed_width = FALSE`, `layout_column_wrap()` will ensure that the columns are at least `width` wide, unless the parent container is narrower than `width`. (#851)

## Bug fixes

* `toggle_switch()` now works correctly when called from within a Shiny module. `update_switch()` worked as expected, but `toggle_switch()` didn't apply the module's namespace to the `id` of the switch to be updated. (#769)
Expand Down
16 changes: 12 additions & 4 deletions R/layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@
#' * `NULL`
#' * Allows power users to set the `grid-template-columns` CSS property
#' manually, either via a `style` attribute or a CSS stylesheet.
#' @param fixed_width Whether or not to interpret the `width` as a minimum
#' (`fixed_width=FALSE`) or fixed (`fixed_width=TRUE`) width when it is a CSS
#' length unit.
#' @param fixed_width When `width` is greater than 1 or is a CSS length unit,
#' e.g. `"200px"`, `fixed_width` indicates whether that `width` value
#' represents the absolute size of each column (`fixed_width=TRUE`) or the
#' minimum size of a column (`fixed_width=FALSE`). When `fixed_width=FALSE`,
#' new columns are added to a row when `width` space is available and columns
#' will never exceed the container or viewport size. When `fixed_width=TRUE`,
#' all columns will be exactly `width` wide, which may result in columns
#' overflowing the parent container.
#' @param heights_equal If `"all"` (the default), every card in every row of the
#' grid will have the same height. If `"row"`, then every card in _each_ row
#' of the grid will have the same height, but heights may vary between rows.
Expand Down Expand Up @@ -77,7 +82,10 @@ layout_column_wrap <- function(
if (fixed_width) {
paste0("repeat(auto-fit, ", validateCssUnit(width), ")")
} else {
paste0("repeat(auto-fit, minmax(", validateCssUnit(width), ", 1fr))")
sprintf(
"repeat(auto-fit, minmax(min(%s, 100%%), 1fr))",
validateCssUnit(width)
)
}
}
}
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
11 changes: 8 additions & 3 deletions man/layout_column_wrap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.