-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.R
More file actions
32 lines (27 loc) · 773 Bytes
/
app.R
File metadata and controls
32 lines (27 loc) · 773 Bytes
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
library(shiny)
library(colorpicker)
ui <- fluidPage(
titlePanel("colorpicker example"),
sidebarLayout(
sidebarPanel(
selectInput("pickerType", "Picker Type", eval(formals(colorpickerInput)$type)),
textOutput("chosenPicker"),
textOutput("chosenColor")
),
mainPanel(uiOutput("colorpicker"))
)
)
server <- function(input, output, session) {
color <- reactiveVal("#ffffff")
observeEvent(input$color, color(input$color))
output$colorpicker <- renderUI({
colorpickerInput("color", color(), type = input$pickerType)
})
output$chosenPicker <- renderText({
sprintf("Selected picker: %s", input$pickerType)
})
output$chosenColor <- renderText({
sprintf("Selected color: %s", input$color)
})
}
shinyApp(ui, server)