Skip to content

Commit

Permalink
add a miniUI example
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Mar 4, 2016
1 parent bf05a3e commit b6b1905
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions inst/examples/apps/miniUI/app.R
@@ -0,0 +1,58 @@
library(shiny)
library(miniUI)
library(leaflet)
library(ggplot2)

ui <- miniPage(
gadgetTitleBar("Shiny gadget example"),
miniTabstripPanel(
miniTabPanel("Parameters", icon = icon("sliders"),
miniContentPanel(
sliderInput("year", "Year", 1978, 2010, c(2000, 2010), sep = "")
)
),
miniTabPanel("Visualize", icon = icon("area-chart"),
miniContentPanel(
plotOutput("cars", height = "100%")
)
),
miniTabPanel("Map", icon = icon("map-o"),
miniContentPanel(padding = 0,
leafletOutput("map", height = "100%")
),
miniButtonBlock(
actionButton("resetMap", "Reset")
)
),
miniTabPanel("Data", icon = icon("table"),
miniContentPanel(
DT::dataTableOutput("table")
)
),
selected = "Map"
)
)

server <- function(input, output, session) {
output$cars <- renderPlot({
require(ggplot2)
ggplot(cars, aes(speed, dist)) + geom_point()
})

output$map <- renderLeaflet({
force(input$resetMap)

leaflet(quakes, height = "100%") %>% addTiles() %>%
addMarkers(lng = ~long, lat = ~lat)
})

output$table <- DT::renderDataTable({
diamonds
})

observeEvent(input$done, {
stopApp(TRUE)
})
}

shinyApp(ui, server)

0 comments on commit b6b1905

Please sign in to comment.