Open ghost opened 6 years ago
Can you supply a reproducible example? When I run this, the width gets set correctly:
> infoBox("a", "b", width=1)
<div class="col-sm-1">
<div class="info-box">
<span class="info-box-icon bg-aqua">
<i class="fa fa-bar-chart"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">a</span>
<span class="info-box-number">b</span>
</div>
</div>
</div>
It looks like you might be using renderUI
?
You are absolutely right Winston, I am using renderInfoBox since I need to programmatically populate title, value, subtitle and href. Moreover I also loop over the renderInfoBox to create many boxes. Below is MWE and the generated HTML (the div section). As you can see the class has ''col-sm-4' Thank you so much for the awesome shinydashboard package and your time helping with this.
R
library(shiny)
library(shinydashboard)
server <- function(input, output) {
output$test <- renderInfoBox({
infoBox(
'company'
, 'text'
, 'location'
, href = 'https://www.rstudio.com/'
, width = 6
)
})
}
body <- dashboardBody(
infoBoxOutput(outputId = 'test')
)
ui <- dashboardPage(
dashboardHeader(disable = TRUE),
dashboardSidebar(disable = TRUE),
body
)
shinyApp(ui, server)
HTML
<div class="shiny-html-output col-sm-4 shiny-bound-output" id="test"><a href="https://www.rstudio.com/">
<div class="info-box">
<span class="info-box-icon bg-aqua">
<i class="fa fa-bar-chart"></i>
</span>
<div class="info-box-content">
<span class="info-box-text">company</span>
<span class="info-box-number">text</span>
<p>location</p>
</div>
</div>
</a></div>
I don't think this is fixed yet but I have found a work around for anyone who still has an issue with this. Instead of using renderInfoBox and infoBoxOutput, I used renderUI and uiOutput and that worked for me. This makes me think there is an issue with the renderInfoBox function.
Got same issue here
infoBox() width parameter stays 4 regardless of the value specified in a function call. For example I want to set width to 6, but I still get 4. Below are the function call and the generated HTML:
infoBox( dtSub$company , dtSub$text , href = dtSub$link , icon = icon("briefcase") , width = 6 )