forked from RinteRface/shinydashboardPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
css-preloader.Rmd
56 lines (50 loc) · 1.42 KB
/
css-preloader.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
title: "CSS preloaders"
author: "David Granjon"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{CSS preloaders}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
## How to set up a preloader?
Pass the argument `preloader` to the `dashboardPage()` function. It expects a nested list containing all parameters necessary to `waiter::waiterShowOnLoad`. Please have a look to the `{waiter}`
[documentation](https://waiter.john-coene.com/) for more details.
That's all!
```{r waiter-code, eval=FALSE}
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(waiter)
shinyApp(
ui = dashboardPage(
preloader = list(html = tagList(spin_1(), "Loading ..."), color = "#3c8dbc"),
header = dashboardHeader(),
sidebar = dashboardSidebar(),
body = dashboardBody(
actionButton("reload", "Reload")
),
title = "Preloader"
),
server = function(input, output, session) {
# fake reload
observeEvent(input$reload, {
session$reload()
})
}
)
```
<div class="marvel-device ipad black">
<div class="camera"></div>
<div class="screen">
<iframe width="100%" src="https://dgranjon.shinyapps.io/shinydashboardPlus-preloader/" allowfullscreen="" frameborder="0" scrolling="yes" height="770px"></iframe>
</div>
<div class="home"></div>
</div>