-
Notifications
You must be signed in to change notification settings - Fork 1
/
layout_tabs_ui.R
74 lines (55 loc) · 2.08 KB
/
layout_tabs_ui.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
## ------------------------------------- ##
# Layout Options - Tabs
## ------------------------------------- ##
# Call needed libraries
library(shiny); library(htmltools); library(lterpalettefinder)
# User Interface (UI) --------------
tabs_ui <- fluidPage(
# Add a title that appears in the browser tab
title = "Shiny Tabs",
# Title within app
headerPanel(list(title = "Layout Options - Tabs",
htmltools::img(src = "lter_logo.png",
height = 42,
align = "right") ) ),
# Decide on layout
tabsetPanel(
# UI - Tab 1 Content ----
tabPanel(title = "Bins & Color",
# Heading
htmltools::h3("Decide on Number of Histogram Bins"),
# Slider for deciding on number of historgram bins
sliderInput(inputId = "bin_num",
label = "Number of bins:",
min = 5, value = 30, max = 50),
# Heading
htmltools::h3("Pick a Plot Color"),
# Color dropdown menu
selectInput(inputId = "color",
label = "Choose a Color",
choices = palette_find(site = "LTER"),
selected = palette_find(site = "LTER")[2])
), # Close `tabPanel(...`
# UI - Tab 2 Content ----
tabPanel(title = "Labels",
# Heading
htmltools::h3("Enter Plot Labels"),
# X-axis label
textInput(inputId = "x_lab", label = "X-Axis Label"),
# Y-axis label
textInput(inputId = "y_lab", label = "Y-Axis Label"),
# Plot title
textInput(inputId = "title", label = "Plot Title"),
), # Close `column(...`
# UI - Tab 3 Content ----
tabPanel(title = "Plot",
plotOutput(outputId = "histo")
) # Close `column(...`
) # Close `fluidRow(...`
) # Close `fluidPage(...`
# Server ---------------------------
# To better demonstrate that layout is *only* a UI thing, all layout options will use the same script containing the server function
source("layout_server.R")
# Assemble App ---------------------
shinyApp(ui = tabs_ui, server = layout_server)
# End ----