I use the library shinydashboard to write my ui.R. In my dashboardBody part, I wrote:
fluidRow(infoBoxOutput("dri"))
And then in my server.R, I wrote:
output$dri = renderInfoBox({
infoBox(
width = 2,
title = tags$b("Score"),
value = tags$b("100"),
color = "aqua",
fill = TRUE,
icon = icon("edit")
)
})*
But the width won't change to 2; it still uses the default one, i.e. 4 (1/3 of the whole webpage width). Would someone help me with this? Thank you very much!
Maybe you can style
it yourself
rm(list = ls())
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(fluidRow(infoBoxOutput("dri")),tags$style("#dri {width:200px;}"))
)
server <- function(input, output) {
output$dri <- renderInfoBox({
infoBox(
title = tags$b("Score"),
value = tags$b("100"),
color = "aqua",
fill = TRUE,
icon = icon("edit")
)
})
}
shinyApp(ui, server)
200 px
1000px
I found this answer on github and it worked for me aswell:
Instead of using renderInfoBox and infoBoxOutput, you can use renderUI and uiOutput and that worked for me. This makes me think there is an issue with the renderInfoBox function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With