Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fill_container argument for a responsive spinner ui container #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Imports:
digest,
glue,
grDevices,
htmltools (>= 0.3.5),
htmltools (>= 0.5.4),
shiny
Suggests:
shinydisconnect,
shinyjs
RoxygenNote: 7.1.0
RoxygenNote: 7.2.1
Roxygen: list(markdown = TRUE)
Encoding: UTF-8
8 changes: 6 additions & 2 deletions R/withSpinner.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#' size of the image is used. Ignored if not using `image`.
#' @param hide.ui By default, while an output is recalculating, the output UI is hidden and the spinner is visible instead.
#' Setting `hide.ui = FALSE` will result in the spinner showing up on top of the previous output UI.
#' @param fill_container By default, the spinner UI container height is fixed to the proxy.height
#' Setting `fill_container = TRUE` will allow the spinner UI container to grow and shrink with their parent container
#' @examples
#' if (interactive()) {
#' library(shiny)
Expand Down Expand Up @@ -46,7 +48,8 @@ withSpinner <- function(
proxy.height = NULL,
id = NULL,
image = NULL, image.width = NULL, image.height = NULL,
hide.ui = TRUE
hide.ui = TRUE,
fill_container = FALSE
) {

if (!inherits(ui_element, "shiny.tag") && !inherits(ui_element, "shiny.tag.list")) {
Expand Down Expand Up @@ -126,7 +129,8 @@ withSpinner <- function(
class = paste(
"shiny-spinner-output-container",
if (hide.ui) "shiny-spinner-hideui" else "",
if (is.null(image)) "" else "shiny-spinner-custom"
if (is.null(image)) "" else "shiny-spinner-custom",
if(fill_container) "html-fill-item html-fill-container" else ""
),
shiny::div(
class = paste(
Expand Down
6 changes: 5 additions & 1 deletion man/withSpinner.Rd

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