forked from DivadNojnarg/outstanding-shiny-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
going-further-where-to-go.Rmd
65 lines (58 loc) · 2.99 KB
/
going-further-where-to-go.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# What to do next? {#going-further-where-to-go}
If you're still alive by reaching this part, well, congrats!
Hopefully, you now have a better understanding of how you may quickly and without too much pain
deeply customize your shiny apps. This book has quite a lot of content, yet we just
scratched the surface of what you may do with a bit of technique. There are
many other topics that could have been covered. Below we give some
references that you probably want to explore, should you like to go even further.
## Multi-page Shiny apps
As shown all along this book, Shiny is not natively designed to
end up with a multi-page website. Packages like `{shiny.router}` [@R-shiny.router] or `{blaze}` [@R-blaze]
provide sorts of workarounds by playing with the url to mimick the multi-page layout.
Yet this is not an authentic multi-page experience! A recent in-development package,
namely `{brochure}` [@R-brochure] aims at filling this gap, offering a real multi-page [solution](https://colinfay.me/brochure-r-package/).
You may have a try:
```{r, eval=FALSE}
remotes::install_github("ColinFay/brochure")
library(brochure)
library(shiny)
brochureApp(
# First page
page(
href = "/",
ui = fluidPage(
h1("This is my first page"),
plotOutput("plot")
),
server = function(input, output, session){
output$plot <- renderPlot({
plot(cars)
})
}
),
# Second page, without any server-side function
page(
href = "/page2",
ui = fluidPage(
h1("This is my second page"),
tags$p("There is no server function in this one")
)
)
)
```
When you run the above example, the app opens on the first page. Typing
`/page2` in the search bar goes to the second page. Each page corresponds to
a new Shiny __session__, requiring __cookies__ if you want to exchange
information from page to page. Everything is still experimental but promising for sure!
## Web design best practices for Shiny
You may wonder why there was not even one chapter about UI conception best practices.
In this book, we chose a opinionated approach where we focused on building tools to customize interfaces rather than
building the interface itself. Yet, after having a custom design, you probably want to
organize it better in a well-polished interface. We cannot better recommend you to go through these two chapters:
[UX Matters](https://engineering-shiny.org/ux-matters.html) and [Don’t rush into coding](https://engineering-shiny.org/dont-rush-into-coding.html) from [@thinkrShiny], as well as read
the layout [basics](https://mastering-shiny.org/action-layout.html#multi-page-layouts) from _Mastering Shiny_ [@wickham2021mastering].
Keep in mind, your design should follow the two golden rules: __simplicity__ and __usability__!
## Conclusion
Your journey doesn't stop here. Web development hides tons of further opportunities. Great
advice is to regularly check the recent innovation in the field and experiment yourself. Don't be afraid of
failing, as this is the usual price to learn new things!