forked from dreamRs/shinyWidgets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
useShinydashboardPlus.Rd
194 lines (176 loc) · 4.16 KB
/
useShinydashboardPlus.Rd
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/useShinydashboardPlus.R
\name{useShinydashboardPlus}
\alias{useShinydashboardPlus}
\title{Use 'shinydashboardPlus' in 'shiny'}
\usage{
useShinydashboardPlus()
}
\description{
Allow to use functions from 'shinydashboardPlus' into a classic 'shiny' app.
}
\examples{
if (interactive()) {
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)
# example taken from ?box
ui <- fluidPage(
tags$h2("Classic shiny"),
# use this in non shinydashboardPlus app
useShinydashboardPlus(),
setBackgroundColor(color = "ghostwhite"),
# boxPlus
fluidRow(
boxPlus(
title = "Closable Box with dropdown",
closable = TRUE,
status = "warning",
solidHeader = FALSE,
collapsible = TRUE,
enable_dropdown = TRUE,
dropdown_icon = "wrench",
dropdown_menu = dropdownItemList(
dropdownItem(url = "http://www.google.com", name = "Link to google"),
dropdownItem(url = "#", name = "item 2"),
dropdownDivider(),
dropdownItem(url = "#", name = "item 3")
),
p("Box Content")
),
boxPlus(
title = "Closable box, with label",
closable = TRUE,
enable_label = TRUE,
label_text = 1,
label_status = "danger",
status = "warning",
solidHeader = FALSE,
collapsible = TRUE,
p("Box Content")
)
),
br(),
# gradientBoxes
fluidRow(
gradientBox(
title = "My gradient Box",
icon = "fa fa-th",
gradientColor = "teal",
boxToolSize = "sm",
footer = column(
width = 12,
align = "center",
sliderInput(
"obs",
"Number of observations:",
min = 0, max = 1000, value = 500
)
),
plotOutput("distPlot")
),
gradientBox(
title = "My gradient Box",
icon = "fa fa-heart",
gradientColor = "maroon",
boxToolSize = "xs",
closable = TRUE,
footer = "The footer goes here. You can include anything",
"This is a gradient box"
)
),
br(),
# extra elements
fluidRow(
column(
width = 6,
timelineBlock(
reversed = FALSE,
timelineEnd(color = "danger"),
timelineLabel(2018, color = "teal"),
timelineItem(
title = "Item 1",
icon = "gears",
color = "olive",
time = "now",
footer = "Here is the footer",
"This is the body"
),
timelineItem(
title = "Item 2",
border = FALSE
),
timelineLabel(2015, color = "orange"),
timelineItem(
title = "Item 3",
icon = "paint-brush",
color = "maroon",
timelineItemMedia(src = "http://placehold.it/150x100"),
timelineItemMedia(src = "http://placehold.it/150x100")
),
timelineStart(color = "gray")
)
),
column(
width = 6,
box(
title = "Box with boxPad containing inputs",
status = "warning",
width = 12,
fluidRow(
column(
width = 6,
boxPad(
color = "gray",
sliderInput(
"obs2",
"Number of observations:",
min = 0, max = 1000, value = 500
),
checkboxGroupInput(
"variable",
"Variables to show:",
c(
"Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear"
)
),
knobInput(
inputId = "myKnob",
skin = "tron",
readOnly = TRUE,
label = "Display previous:",
value = 50,
min = -100,
displayPrevious = TRUE,
fgColor = "#428BCA",
inputColor = "#428BCA"
)
)
),
column(
width = 6,
plotOutput("distPlot2", height = "200px"),
tableOutput("data")
)
)
)
)
)
)
server <- function(input, output, session) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs))
})
output$distPlot2 <- renderPlot({
hist(rnorm(input$obs2))
})
output$data <- renderTable({
head(mtcars[, c("mpg", input$variable), drop = FALSE])
}, rownames = TRUE)
}
shinyApp(ui, server)
}
}