0

Here is my UI Code for shiny

ui <- navbarPage(title = "Shiny-Box",
                 tabPanel(title = "Daily", tags$head(
                   tags$style(
                     HTML(
                       ".custom-valuebox { 
                       background-color: green;
                      }"
                     )
                   )
                 ),
                          fluidPage(
                            fluidRow(
                              column(3, selectInput(inputId= "platform", "Platform", choices = c("Google", "Facebook", "LinkedIn"), selected = "Google")),
                              column(3, uiOutput("metric")),
                              column(3, uiOutput("category")),
                              column(3, dateRangeInput('dateRange',
                                                       label = 'Date range input: yyyy-mm-dd',
                                                       start ='2023-01-01', end = Sys.Date() + 2
                              )),
                              column(4, valueBoxOutput("value"))
                            ),
                            fluidRow(
                              column(12, dataTableOutput("dt1"))
                            )
                          )
                 ),
                 

and then for the server code is like :

output$value <- renderValueBox({
        a <- paste0(input$platform)
        b <- paste0(input$metric)
        c <- paste0(input$category)
        x <- paste(a,b,c)
        dt1 <- switch(x, 
                      "Facebook Lead SCN" = LeadSCN %>%
                        filter(Date >= input$dateRange[1] & Date <= input$dateRange[2]),
                      "Facebook Click SCN" = ClickSCN %>%  filter(Date >= input$dateRange[1] & Date <= input$dateRange[2]),
        )
        sum_budget_per_day <- sum(dt1$`Budget Per Day`)
        valueBox(sum_budget_per_day, "Total Budget Per Day", 
                 icon = icon("usd"), 
                 color = "purple",
                 width = 4,
                 div(class = "custom-valuebox"))
      })

And the result is like this :

Result

how do I move the Total Budget Per Day Title above its value, then how do I get rid of the html line that appears when hovered and where is my coding wrong because the background color also doesn't change to green or purple I've tried removing the class div but it still doesn't work even so I tried with the class div only not with the color function.

The background color is changing

zx8754
  • 52,746
  • 12
  • 114
  • 209
  • 1
    What do you want to do? or maybe you could share an example picture of what you want it to look like? – Russ Mar 17 '23 at 21:01
  • 2
    Can you also share an example that works? the code in the question is missing parenthesis and the server function. – Russ Mar 17 '23 at 21:04

0 Answers0