Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R shinydashboard - change height of valueBox

Given a shinydashboard

ui.R

library(shinydashboard)
library(shiny)

dashboardPage(

    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
        valueBoxOutput(outputId = "vb")
    )
)

server.R

library(shinydashboard)
library(shiny)

function(input, output, session) {

    output$vb <- renderValueBox({
        valueBox(subtitle = "Hello", 
                         value = "hi", 
                         width = 6,
                         color="blue"
        )
    })
}

Question

Is it possible to change the height of the valueBox?

I've tried using tags but can't get them to work so I'm obviously missing something:

dashboardPage(

    dashboardHeader(),
    dashboardSidebar(
    #   tags$head(tags$style("#vb{height:500px}"))
    ),
    dashboardBody(
        # tags$head(tags$style("#vb{height:500px}")),

        # div(style="height: 500px",
        #       valueBoxOutput(outputId = "vb")
        # )
        valueBoxOutput(outputId = "vb")
    )
)
like image 488
tospig Avatar asked Dec 02 '22 13:12

tospig


1 Answers

It turns out I wasn't referencing the value box correctly; I need to use the .small-box class:

dashboardPage(

    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
        tags$head(tags$style(HTML(".small-box {height: 50px}"))),
        valueBoxOutput(outputId = "vb")
    )
)
like image 182
tospig Avatar answered Dec 15 '22 10:12

tospig