Skip to content

Commit c87968d

Browse files
committed
Add fill arguments to plotOutput(), imageOutput(), and uiOutput()
1 parent cda59da commit c87968d

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Imports:
7979
jsonlite (>= 0.9.16),
8080
xtable,
8181
fontawesome (>= 0.2.1),
82-
htmltools (>= 0.5.2),
82+
htmltools (>= 0.5.3.9001),
8383
R6 (>= 2.0),
8484
sourcetools,
8585
later (>= 1.0.0),
@@ -209,3 +209,5 @@ RdMacros: lifecycle
209209
Config/testthat/edition: 3
210210
Config/Needs/check:
211211
rstudio/shinytest2
212+
Remotes:
213+
rstudio/htmltools

R/bootstrap.R

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -792,9 +792,9 @@ verbatimTextOutput <- function(outputId, placeholder = FALSE) {
792792
#' @name plotOutput
793793
#' @rdname plotOutput
794794
#' @export
795-
imageOutput <- function(outputId, width = "100%", height="400px",
795+
imageOutput <- function(outputId, width = "100%", height = "400px",
796796
click = NULL, dblclick = NULL, hover = NULL, brush = NULL,
797-
inline = FALSE) {
797+
inline = FALSE, fill = TRUE) {
798798

799799
style <- if (!inline) {
800800
# Using `css()` here instead of paste/sprintf so that NULL values will
@@ -850,7 +850,11 @@ imageOutput <- function(outputId, width = "100%", height="400px",
850850
}
851851

852852
container <- if (inline) span else div
853-
do.call(container, args)
853+
res <- do.call(container, args)
854+
if (fill) {
855+
res <- asFillItem(res)
856+
}
857+
res
854858
}
855859

856860
#' Create an plot or image output element
@@ -1088,11 +1092,11 @@ imageOutput <- function(outputId, width = "100%", height="400px",
10881092
#' @export
10891093
plotOutput <- function(outputId, width = "100%", height="400px",
10901094
click = NULL, dblclick = NULL, hover = NULL, brush = NULL,
1091-
inline = FALSE) {
1095+
inline = FALSE, fill = TRUE) {
10921096

10931097
# Result is the same as imageOutput, except for HTML class
10941098
res <- imageOutput(outputId, width, height, click, dblclick,
1095-
hover, brush, inline)
1099+
hover, brush, inline, fill)
10961100

10971101
res$attribs$class <- "shiny-plot-output"
10981102
res
@@ -1155,12 +1159,16 @@ dataTableOutput <- function(outputId) {
11551159
#' )
11561160
#' @export
11571161
htmlOutput <- function(outputId, inline = FALSE,
1158-
container = if (inline) span else div, ...)
1162+
container = if (inline) span else div, fill = FALSE, ...)
11591163
{
11601164
if (any_unnamed(list(...))) {
11611165
warning("Unnamed elements in ... will be replaced with dynamic UI.")
11621166
}
1163-
container(id = outputId, class="shiny-html-output", ...)
1167+
res <- container(id = outputId, class = "shiny-html-output", ...)
1168+
if (fill) {
1169+
res <- asFillContainer(res, asItem = TRUE)
1170+
}
1171+
res
11641172
}
11651173

11661174
#' @rdname htmlOutput

0 commit comments

Comments
 (0)