File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 2
2
.Rhistory
3
3
.RData
4
4
.Ruserdata
5
+
6
+ /.quarto /
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Pairing {quarto-shinylive} and {quarto-webr}
3
+ format :
4
+ html :
5
+ resources :
6
+ - shinylive-sw.js
7
+ engine : knitr
8
+ filters :
9
+ - webr
10
+ - shinylive
11
+ ---
12
+
13
+ ## quarto-shinylive
14
+
15
+ Example of a Shinylive application inside of the Quarto document.
16
+
17
+ ``` {shinylive-r}
18
+ #| standalone: true
19
+ library(shiny)
20
+ library(bslib)
21
+ library(shinylive)
22
+
23
+ is_shinylive <- function() { R.Version()$arch == "wasm32"}
24
+
25
+ ui <- page_fillable(
26
+ class = "d-flex flex-column text-center align-items-center justify-content-center",
27
+ h1("Is this app running in shinylive?"),
28
+ textOutput("in_shinylive", container = \(...) p(..., class="fs-2 fw-bold"))
29
+ )
30
+
31
+ server <- function(input, output, session) {
32
+ output$in_shinylive <- renderText({
33
+ if (is_shinylive()) "Yes." else "No."
34
+ })
35
+ }
36
+
37
+ shinyApp(ui, server)
38
+ ```
39
+
40
+ ## quarto-webr
41
+
42
+ Example of the {quarto-webr} Extension working alongside a {quarto-shinylive}
43
+ cell.
44
+
45
+ ### Interactive
46
+
47
+ ``` {webr-r}
48
+ print("hello quarto-webr world!")
49
+ ```
50
+
51
+ ### Non-interactive
52
+
53
+ ``` {webr-r}
54
+ #| context: output
55
+ cat("And, this is a non-interactive cell", fill = TRUE)
56
+ ```
You can’t perform that action at this time.
0 commit comments