Skip to content

Commit a5d679e

Browse files
authored
docs: add shinylive to the getting started vignette (#1491)
Part of #1404
1 parent 73664cf commit a5d679e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

vignettes/getting-started-with-teal.Rmd

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ More advanced users of the framework can also create new analysis modules which
2929

3030
This simple `teal` application takes the `iris` and `mtcars` datasets and displays their contents:
3131

32-
```{r message=FALSE, warning=FALSE}
32+
```{r setup, include=FALSE}
33+
library(teal)
34+
```
35+
36+
```{r app}
3337
library(teal)
3438
3539
app <- init(
@@ -81,6 +85,17 @@ Every `teal` application is composed of the following elements, all of which can
8185
* <span style="color: #3A88FE;">Filter Panel</span> _(panel on the right hand side)_: for filtering the data to be passed into all `teal` modules.
8286
* In the example code: the filter panel is being initialized with a filter for the `Species` variable in the `iris` dataset.
8387

88+
## Try the above app in `shinylive`
89+
90+
```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', eval = requireNamespace("roxy.shinylive", quietly = TRUE) && knitr::is_html_output() && identical(Sys.getenv("IN_PKGDOWN"), "true")}
91+
code <- paste0(c(
92+
"interactive <- function() TRUE",
93+
knitr::knit_code$get("app")
94+
), collapse = "\n")
95+
url <- roxy.shinylive::create_shinylive_url(code)
96+
knitr::include_url(url, height = "800px")
97+
```
98+
8499
## Creating your own applications
85100

86101
The key function to use to create your `teal` application is `init`, which requires two mandatory arguments: `data` and `modules`. There are other optional arguments for `init`, which can be used to customize the application. Please refer to the documentation for `init` for further details.

0 commit comments

Comments
 (0)