Cover the page, or one element, while something is being worked out.
Each mask is named, and stays until el_loading_close() is called with the
same id.
Usage
el_loading(
session = shiny::getDefaultReactiveDomain(),
id = "default",
text = NULL,
target = NULL,
fullscreen = NULL,
lock = NULL,
body = NULL,
spinner = NULL,
background = NULL,
custom_class = NULL,
svg = NULL,
svg_view_box = NULL,
before_close = NULL
)Arguments
- session
Shiny session; the current one by default, as for
shiny::updateTextInput().- id
Name for this mask, used to close it again.
- text
Text shown under the spinner.
- target
CSS selector of the element to cover.
NULLcovers the page.- fullscreen
Whether the mask covers the viewport. Default
TRUEwhen notargetis given.- lock
Whether to stop the page scrolling underneath.
- body
Whether the mask is inserted into
bodyrather than the target.- spinner
Class name of a custom spinner.
- background
Background colour of the mask.
- custom_class
Extra class name.
- svg, svg_view_box
A spinner of your own, as SVG path markup and its
viewBox.- before_close
JS()function returning whether the mask may close.
Examples
if (interactive()) {
library(shiny)
library(shiny.element)
ui <- el_page(el_button("go", "Fetch"), el_table("out"))
server <- function(input, output, session) {
observeEvent(input$go, {
el_loading(session, "fetching", text = "Fetching rows...")
on.exit(el_loading_close(session, "fetching"), add = TRUE)
update_el_table(session, "out", data = slow_query())
})
}
shinyApp(ui, server)
}