Skip to content

Commit 489e6c6

Browse files
committed
Add demo document
1 parent 07a97b1 commit 489e6c6

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
.Rhistory
33
.RData
44
.Ruserdata
5+
6+
/.quarto/

shinyliveandwebr.qmd

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
```

0 commit comments

Comments
 (0)