diff --git a/inst/examples/apps/miniUI/app.R b/inst/examples/apps/miniUI/app.R new file mode 100644 index 000000000..1cf7bfd63 --- /dev/null +++ b/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)