Debian Codegraph @

R/shinythemes-package.r

raw symbols SCIP
1 #' Themes for Shiny
2 #'
3 #' This package contains Bootstrap themes from https://bootswatch.com/, which are
4 #' packaged for use with Shiny applications. The themes included are:
5 #'
6 #' \itemize{
7 #' \item \href{https://bootswatch.com/3/cerulean/}{cerulean}
8 #' \item \href{https://bootswatch.com/3/cosmo/}{cosmo}
9 #' \item \href{https://bootswatch.com/3/cyborg/}{cyborg}
10 #' \item \href{https://bootswatch.com/3/darkly/}{darkly}
11 #' \item \href{https://bootswatch.com/3/flatly/}{flatly}
12 #' \item \href{https://bootswatch.com/3/journal/}{journal}
13 #' \item \href{https://bootswatch.com/3/lumen/}{lumen}
14 #' \item \href{https://bootswatch.com/3/paper/}{paper}
15 #' \item \href{https://bootswatch.com/3/readable/}{readable}
16 #' \item \href{https://bootswatch.com/3/sandstone/}{sandstone}
17 #' \item \href{https://bootswatch.com/3/simplex/}{simplex}
18 #' \item \href{https://bootswatch.com/3/slate/}{slate}
19 #' \item \href{https://bootswatch.com/3/spacelab/}{spacelab}
20 #' \item \href{https://bootswatch.com/3/superhero/}{superhero}
21 #' \item \href{https://bootswatch.com/3/united/}{united}
22 #' \item \href{https://bootswatch.com/3/yeti/}{yeti}
23 #' }
24 #'
25 #' To use the themes, use the \code{theme} argument to
26 #' \code{\link[shiny]{bootstrapPage}}, \code{\link[shiny]{fluidPage}},
27 #' \code{\link[shiny]{navbarPage}}, or \code{\link[shiny]{fixedPage}}. The value
28 #' should be \code{shinytheme("cerulean")}, where the theme name takes the place
29 #' of \code{"cerulean"}.
30 #'
31 #' @examples
32 #' \dontrun{
33 #' library(shiny)
34 #' library(shinythemes)
35 #'
36 #' # A very basic navbar page with different themes
37 #' shinyApp(
38 #' ui = navbarPage("Default theme",
39 #' tabPanel("Plot", "Plot tab contents..."),
40 #' navbarMenu("More",
41 #' tabPanel("Summary", "Summary tab contents..."),
42 #' tabPanel("Table", "Table tab contents...")
43 #' )
44 #' ),
45 #' server = function(input, output) { }
46 #' )
47 #'
48 #' shinyApp(
49 #' ui = navbarPage("United",
50 #' theme = shinytheme("united"),
51 #' tabPanel("Plot", "Plot tab contents..."),
52 #' navbarMenu("More",
53 #' tabPanel("Summary", "Summary tab contents..."),
54 #' tabPanel("Table", "Table tab contents...")
55 #' )
56 #' ),
57 #' server = function(input, output) { }
58 #' )
59 #'
60 #' shinyApp(
61 #' ui = navbarPage("Cerulean",
62 #' theme = shinytheme("cerulean"),
63 #' tabPanel("Plot", "Plot tab contents..."),
64 #' navbarMenu("More",
65 #' tabPanel("Summary", "Summary tab contents..."),
66 #' tabPanel("Table", "Table tab contents...")
67 #' )
68 #' ),
69 #' server = function(input, output) { }
70 #' )
71 #'
72 #'
73 #' # A more complicated app with the flatly theme
74 #' shinyApp(
75 #' ui = fluidPage(
76 #' theme = shinytheme("flatly"),
77 #' titlePanel("Tabsets"),
78 #' sidebarLayout(
79 #' sidebarPanel(
80 #' radioButtons("dist", "Distribution type:",
81 #' c("Normal" = "norm",
82 #' "Uniform" = "unif",
83 #' "Log-normal" = "lnorm",
84 #' "Exponential" = "exp")),
85 #' br(),
86 #' sliderInput("n", "Number of observations:",
87 #' value = 500, min = 1, max = 1000)
88 #' ),
89 #' mainPanel(
90 #' tabsetPanel(type = "tabs",
91 #' tabPanel("Plot", plotOutput("plot")),
92 #' tabPanel("Summary", verbatimTextOutput("summary")),
93 #' tabPanel("Table", tableOutput("table"))
94 #' )
95 #' )
96 #' )
97 #' ),
98 #' server = function(input, output) {
99 #' data <- reactive({
100 #' dist <- switch(input$dist,
101 #' norm = rnorm,
102 #' unif = runif,
103 #' lnorm = rlnorm,
104 #' exp = rexp,
105 #' rnorm)
106 #' dist(input$n)
107 #' })
108 #'
109 #' output$plot <- renderPlot({
110 #' dist <- input$dist
111 #' n <- input$n
112 #' hist(data(), main=paste('r', dist, '(', n, ')', sep=''))
113 #' })
114 #'
115 #' output$summary <- renderPrint({
116 #' summary(data())
117 #' })
118 #'
119 #' output$table <- renderTable({
120 #' data.frame(x=data())
121 #' })
122 #' }
123 #' )
124 #' }
125 #' @name shinythemes
126 #' @docType package
127 NULL