(R闪亮)无法改变infoBox的宽度

Xin*_*ang 4 r shiny shinydashboard

我使用库shinydashboard写我的ui.R. 在我的仪表板中,我写道:

fluidRow(infoBoxOutput("dri"))
Run Code Online (Sandbox Code Playgroud)

然后在我的server.R中,我写道:

output$dri = renderInfoBox({
    infoBox(
        width = 2,
        title = tags$b("Score"),
        value = tags$b("100"),
        color = "aqua",
        fill = TRUE,
        icon = icon("edit")
    )
})*
Run Code Online (Sandbox Code Playgroud)

但宽度不会变为2; 它仍然使用默认值,即4(整个网页宽度的1/3).有人会帮我这个吗?非常感谢你!

Por*_*hop 6

也许你可以style自己做

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)
Run Code Online (Sandbox Code Playgroud)

200像素 在此输入图像描述

1000像素 在此输入图像描述