knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

It is also possible to push these Tiles into a Shiny app, using the htmlOutput and renderUI.

You can either assign objects outside the Shiny call (in the below example b1 and d1 which includes b1 and b2), or you can embed buttons inside the Shiny app to display values from there.

(In order to make this work, uncomment the last line in your console. )

library(dplyr)
library(htmltools)
library(TileMaker)

b1 <- solo_box(value = 3.57, txt = "Times apple eaten", icon = "apple")
b2 <- solo_box(value = 13.7, txt = "Nutritional value", size = "lg")

d1 <- div_maker(subtitle = "Quantativity factors", textModifier = "h2", b1, b2)

# ## Shinydashboard Test --------------
# ## app.R ##
# library(shinydashboard)
# library(shiny)
# 
# ui <- dashboardPage(
#   dashboardHeader(title = "Basic dashboard"),
#   dashboardSidebar(
#         sliderInput("slider", "Number of observations:", 1, 100, 50)),
#   dashboardBody(
#     # Boxes need to be put in a row (or column)
#     fluidRow(
#       box(
#         b1, d1, htmlOutput("plot1")
#       )
#     )
#   )
# )
# 
# server <- function(input, output) {
#   output$plot1 <- renderUI({
#     div_maker(subtitle = "boom", textModifier = "h2", solo_box(value = input$slider, txt = "Times apple eaten", icon = "apple"))
#   })
# }

# shinyApp(ui, server)


DataStrategist/TileMaker documentation built on Feb. 1, 2022, 9:29 p.m.