Debian Codegraph @

man/shinythemes.Rd

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