UIkit front-end framework for Shiny.
library(shiny)
library(shinyuikit)
shinyApp(
ui = ukPage(
ukSidebarLayout(
ukSidebarToggle("Choose Distribution", sidebar_id = "test"),
ukSidebar(ukRadioInput("dist", "Distribution type:",
c("Normal" = "norm",
"Uniform" = "unif",
"Log-normal" = "lnorm",
"Exponential" = "exp"),
selected = "norm"),
title = "Title", sidebar_id = "test")
),
ukContainer(
ukGrid(
tags$div(
ukCardBody(ukCardTitle("Hover"),
tags$p("Lorem ipsum dolor sit amet, consectetur adipisicing elit"),
plotOutput("hist1"),
hover = TRUE, sortable = TRUE)
),
tags$div(
ukCardBody(ukCardTitle("Default"),
tags$p("Lorem ipsum dolor sit amet, consectetur adipisicing elit."),
plotOutput("hist2"),
style = "default", hover = TRUE, sortable = TRUE)
),
tags$div(
ukCardBody(ukCardTitle("Primary"),
tags$p("Lorem ipsum dolor sit amet, consectetur adipisicing elit."),
plotOutput("hist3"),
style = "primary", hover = TRUE, sortable = TRUE)
),
tags$div(
ukCardBody(ukCardTitle("Secondary"),
tags$p("Lorem ipsum dolor sit amet, consectetur adipisicing elit."),
plotOutput("hist4"),
style = "secondary", hover = TRUE, sortable = TRUE)
),
child_width = "half", match_height = TRUE, allow_sortable = TRUE)
)
),
server = function(input, output) {
dataInput <- reactive({
switch(input$dist,
norm = rnorm,
unif = runif,
lnorm = rlnorm,
exp = rexp,
rnorm)
})
output$hist1 <- renderPlot({
data <- dataInput()
hist(data(1000), col = "darkgrey")
})
output$hist2 <- renderPlot({
data <- dataInput()
hist(data(1000), col = "steelblue")
})
output$hist3 <- renderPlot({
data <- dataInput()
hist(data(1000), col = "wheat")
}, bg = NA)
output$hist4 <- renderPlot({
data <- dataInput()
hist(data(1000), col = "white")
}, bg = NA)
}
)