[UPDATE – December 2020] – A new version of shiny.router was recently released. With it, we decided to write a new article on the library alongisde with a short interactive tutorial. You can read it here.
In a web application, routing is the process of using URLs to drive the user interface. Routing adds more possibilities and flexibility while building a complex and advanced web application, offering dividing app into separated sections.
Previously shiny.router was based on the external page.js library. Thanks to the use of shiny session object we moved it fully to R.
Separated server for each bookmark
Now each bookmark can be isolated and fully working shiny app. The new feature allows you not only to separate UI for each bookmark – you may also define its own server now. Just check below example!
Pass parameters to an app using GET URL variables
Operate routing from the server side
route_link – function for changing url for bookmark by adding hashbang (#!) prefix,
change_page – function for changing the currently displayed page,
get_page – function to extract “hash” part of the url,
is_page – function that verifies if current page is was passed succesfuly.
Styling – Bootstrap and Semantic UI
You can suppress Bootstrap dependency on the specified bookmark. You can switch between Bootstrap and Semantic UI pages or disable styles. This is especially useful when using both Bootstrap and semantic-UI frameworks in one application.
How to get shiny.router?
Shiny.router is available both on R Cran and Github. If you will stumble upon any issues please file them on GitHub where our team will reply. Are you using already shiny.router package in your shiny projects? Say hello to us and share your story – it will help us make our open source better. Look for us on R events and collect our hex stickers!
Further steps and plans for the package
We are planning to constantly work on the package to make it more versatile. As next steps we want to allow passing parameters between separated bookmarks servers and ability to save application state. We hope that you will appreciate improvements we did within last two years.