- Notifications
You must be signed in to change notification settings - Fork1
Switch Between Alternative 'shiny' UIs
License
Unknown, MIT licenses found
Licenses found
shinyworks/scenes
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The goal of {scenes} is to make it easy to switch a {shiny} app betweenalternative UIs. It was designed to abstract the login-wrapper conceptimplemented in{shinyslack}.
Install the released version of {scenes} from CRAN:
install.packages("scenes")Or install the development version of scenes fromGitHub with:
# install.packages("remotes")remotes::install_github("shinyworks/scenes")
You can see a demonstration of {scenes}here.
Some examples of how you might use {scenes} to switch between differentUIs in a Shiny app:
Login Wrapper: Use {scenes} to switch between a login page and themain content of the app. This is the original use case for {scenes}.It ws designed to abstract the login-wrapper concept implemented in{shinyslack}.
App Modes: Use {scenes} to switch between different modes of theapp, such as a view-only mode and an edit mode, via a query parameter(
yourapp.shinyapps.io?mode=edit).User Roles: Use {scenes} to switch between different UIs based onuser roles. For example, a non-admin user might see a different UIthan an admin user.
TheLogin Wrapper example might look like this:
library(shiny)library(scenes)# Define the different scenes for the applogin_ui<- fluidPage( textInput("username","Username"), passwordInput("password","Password"), actionButton("login","Login"))main_ui<- fluidPage( h1("Welcome"), textOutput("username"))# Use the `set_scene()` function to define the different scenes, and# `change_scene()` to switch between them.ui<- change_scene( set_scene(main_ui, req_has_cookie("validate_login",validation_fn=my_validation_fn ) ),fall_through=login_ui)server<-function(input,output,session) { observeEvent(input$login, { use_cookies_package_to_save_cookie_fn(input$username,input$password) })output$username<- renderText({input$username })}shinyApp(ui=ui,server=server)
See{shinyslack} for a fullyimplemented example.
Other packages have implemented features in this domain.
- {brochure}: This packageappears to have a great deal of overlap with {scenes}. Colin Fay’simplementation appears to potentially be more robust and more completethan {scenes}, but at the cost of diverging farther from a “normal”shiny app.
- {shiny.router}: This packagefromAppsilon appears to be conceptuallysimilar to {scenes}, but focused on routing based on URL. Of the threepackages listed here, this is the only one available on CRAN.
- {blaze}: This package from NateTeetor also focuses on routing based on URL. The resulting shiny appsare switched via the server function.
Please note that the scenes project is released with aContributor CodeofConduct.By contributing to this project, you agree to abide by its terms.
About
Switch Between Alternative 'shiny' UIs
Resources
License
Unknown, MIT licenses found
Licenses found
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.