-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshinydashboard_skeleton.R
131 lines (111 loc) · 3.21 KB
/
shinydashboard_skeleton.R
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
### ShinyDashboard Skeleton
# Simple starter framework for a Shiny dashboard with sidebar and tabbed boxes
#
# By Patrick Rogers, California Research Bureau
# Aug 2021
#
# Uses the following Packages
# {shiny}
# {shinydashboard}
# Clear the workspace
remove(list=ls(all=TRUE))
# Inits
#setwd(here::here())
# Load Packages
library(shiny)
library(shinydashboard)
# Load Sourcefiles
# User Parameters
# Custom Functions ####
# Build UI ####
sidebar <- dashboardSidebar(sidebarMenu(
menuItem(
"Issue 1",
tabName = "item1",
icon = icon("train")
),
menuItem(
"Issue 2",
tabName = "item2",
icon = icon("car")
),
menuItem(
"Issue 3",
tabName = "item3",
icon = icon("fire")
),
menuItem(
"Issue 4",
tabName = "item4",
icon = icon("seedling")
),
menuItem(
"Issue 5",
tabName = "item5",
icon = icon("cloud-sun")
)
))
body <- dashboardBody(
tags$head(
# Note the wrapping of the string in HTML()
tags$style(HTML("
/* CSS styles get tested here, before being moved to external for production. */"))
),
tabItems(
# Issue Tab 1 ####
tabItem(tabName = "item1",
h2("Issue Item 1"),
fluidRow(
tabBox(width = 12,
# Panel 1 ####
tabPanel(tagList(shiny::icon("chart-line"), "Panel 1"),
fluidRow(box(width = 12, "Some text"))),
# Panel 2 ####
tabPanel(tagList(shiny::icon("newspaper"), "Panel 2"),
fluidRow(box(width = 6, "Some text"),
box(width = 6, "More text"))),
# Research Subtab
tabPanel(tagList(shiny::icon("book"), "Panel 3"),
fluidRow(box(width = 12, "Some text"),
box(width = 12, "More text")))
))),
# Issue Tab 2 ####
tabItem(tabName = "item2",
h2("Issue Item 2"),
# Boxes need to be put in a row (or column)
fluidRow(
box(
div("Item 2 stuff goes here.")
))),
# Issue Tab 3 ####
tabItem(tabName = "item3",
h2("Issue Item 3"),
fluidRow(
box(
div("Item 3 stuff goes here.")
))),
# Issue Tab 4 ####
tabItem(tabName = "item4",
h2("Issue Item 4"),
fluidRow(
box(
div("Item 4 stuff goes here.")
))),
# Issue Tab 5 ####
tabItem(tabName = "item5",
h2("Issue Item 5"),
fluidRow(
box(
div("You'll never guess what item stuff goes here!")
)))
)
)
ui <- dashboardPage(dashboardHeader(title = "Example Dashboard"),
sidebar,
body)
# Build Server ####
server <- function(input, output, session) {
# Nothing fancy is happening in this, just the UI skeleton
}
# Run! ####
shinyApp(ui, server)