The goal of {shinyfullscreen}
is to enable users to put
some items on fullscreen. This package is the adaptation in R of screenfull.js
.
Install the CRAN version with:
install.packages("shinyfullscreen")
Install the development version with:
# install.packages("devtools")
::install_github("etiennebacher/shinyfullscreen") devtools
Note that {shinyfullscreen}
only works when the Shiny
app is launched in the browser. It won’t work in an
RStudio window.
This package provides three functions that are very similar:
fullscreen_this()
is useful if you want to enable
fullscreen for few elements. Simply wrap this function around the
element for which you want to enable fullscreen, and then click on this
element when the app runs to display it on fullscreen:### Only works in browser
library(shiny)
library(shinyfullscreen)
<- fluidPage(
ui
fullscreen_this(plotOutput("plot"))
# Also works with magrittr's pipe
# plotOutput("plot") %>%
# fullscreen_this()
)
<- function(input, output, session) {
server
$plot <- renderPlot(plot(mtcars))
output
}
shinyApp(ui, server, options = list(launch.browser = TRUE))
fullscreen_those()
is useful if you want to enable
fullscreen view for several items without rewriting the same code again
and again. Simply write your UI as usual, and then call this function
with a list of ids corresponding to the items for which you want to
enable fullscreen view. Note that this function has to be called after
having created these items:### Only works in browser
library(shiny)
library(shinyfullscreen)
<- fluidPage(
ui plotOutput("plot"),
plotOutput("plot2"),
# Has to be placed after plot and plot2
fullscreen_those(items = list("plot", "plot2"))
)
<- function(input, output, session) {
server
$plot <- renderPlot(plot(mtcars))
output$plot2 <- renderPlot(plot(AirPassengers))
output
}
shinyApp(ui, server, options = list(launch.browser = TRUE))
fullscreen_all()
allows you to put the whole page in
fullscreen mode. Note however that this requires clicking on an HTML
element.### Only works in browser
library(shiny)
library(shinyfullscreen)
<- fluidPage(
ui actionButton("page_full", "Show page in fullscreen"),
plotOutput("plot"),
fullscreen_all(click_id = "page_full")
)
<- function(input, output, session) {
server
$plot <- renderPlot(plot(mtcars))
output
}
shinyApp(ui, server, options = list(launch.browser = TRUE))
Please note that the shinyfullscreen project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.