Skip to content

Commit c827d79

Browse files
gadenbuiecpsievert
andauthored
feat(sidebar): Add fillable argument (#1226)
* feat(sidebar): Make sidebar fillable * chore: Add NEWS item * `usethis::use_tidy_description()` (GitHub Actions) * `devtools::document()` (GitHub Actions) * Resave distributed files (GitHub Action) * Resave data (GitHub Action) * Update website deps (GitHub Action) * ci: recheck * docs(sidebar): Remove reference to flexbox Co-authored-by: Carson Sievert <cpsievert1@gmail.com> * `usethis::use_tidy_description()` (GitHub Actions) * Update website deps (GitHub Action) --------- Co-authored-by: gadenbuie <gadenbuie@users.noreply.github.com> Co-authored-by: Carson Sievert <cpsievert1@gmail.com>
1 parent 9562108 commit c827d79

38 files changed

Lines changed: 18 additions & 7 deletions

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Suggests:
5858
utils,
5959
withr,
6060
yaml
61-
Config/Needs/deploy:
61+
Config/Needs/deploy:
6262
BH,
6363
chiflights22,
6464
colourpicker,
@@ -89,7 +89,7 @@ Config/Needs/deploy:
8989
styler,
9090
tibble
9191
Config/Needs/routine: chromote, desc, renv
92-
Config/Needs/website:
92+
Config/Needs/website:
9393
brio,
9494
crosstalk,
9595
dplyr,
@@ -110,7 +110,8 @@ Config/Needs/website:
110110
webshot2
111111
Config/testthat/edition: 3
112112
Config/testthat/parallel: true
113-
Config/testthat/start-first: zzzz-bs-sass, fonts, zzz-precompile, theme-*, rmd-*
113+
Config/testthat/start-first: zzzz-bs-sass, fonts, zzz-precompile, theme-*,
114+
rmd-*
114115
Encoding: UTF-8
115116
Roxygen: list(markdown = TRUE)
116117
RoxygenNote: 7.3.2

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
* Sidebars from `page_sidebar()` and `layout_sidebar()` are now resizable on desktop-sized screen widths, allowing users to resize the sidebar width as desired. (#1217)
1414

15+
* `sidebar()` gains a `fillable` argument to support vertical fill behavior in sidebars. (#1226)
16+
1517
# bslib 0.9.0
1618

1719
## Breaking changes

R/sidebar.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
#' second will be left and right, and the third will be bottom. If four, then
8585
#' the values will be interpreted as top, right, bottom, and left
8686
#' respectively.
87+
#' @param fillable Whether or not the sidebar should be considered a fillable
88+
#' container. When `TRUE`, the sidebar and its content can
89+
#' use `fill` to consume available vertical space.
8790
#'
8891
#' @export
8992
sidebar <- function(
@@ -98,7 +101,8 @@ sidebar <- function(
98101
class = NULL,
99102
max_height_mobile = NULL,
100103
gap = NULL,
101-
padding = NULL
104+
padding = NULL,
105+
fillable = FALSE
102106
) {
103107
position <- rlang::arg_match(position)
104108
gap <- validateCssUnit(gap)
@@ -145,6 +149,7 @@ sidebar <- function(
145149
width = width,
146150
max_height_mobile = max_height_mobile,
147151
color = list(bg = bg, fg = fg),
152+
fillable = fillable,
148153
attributes = dots$attribs,
149154
children = dots$children
150155
)
@@ -215,8 +220,10 @@ as.tags.bslib_sidebar <- function(x, ...) {
215220
id = x$id,
216221
class = c("sidebar", x$class),
217222
hidden = if (hidden_initially) NA,
223+
if (isTRUE(x$fillable)) as_fillable_container(),
218224
tags$div(
219225
class = "sidebar-content bslib-gap-spacing",
226+
if (isTRUE(x$fillable)) as_fill_carrier(),
220227
x$title,
221228
style = css(
222229
gap = x$gap,

R/sysdata.rda

6.33 KB
Binary file not shown.
184 Bytes
Binary file not shown.
24 Bytes
Binary file not shown.
76 Bytes
Binary file not shown.
-8 Bytes
Binary file not shown.
-48 Bytes
Binary file not shown.
72 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)