shinydashboard icon indicating copy to clipboard operation
shinydashboard copied to clipboard

infoBox() width parameter is stuck on value of 4

Open ghost opened this issue 7 years ago • 4 comments
trafficstars

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 )

<div class="shiny-html-output col-sm-4 shiny-bound-output" id="ibox1"><a href="http://abbvie.jobs/lake-county-il/senior-manager-statistical-programming/FB51233B2DFF4AE38BE6A9A2A4B794FA/job/">
  <div class="info-box">
    <span class="info-box-icon bg-aqua">
      <i class="fa fa-briefcase"></i>
    </span>
    <div class="info-box-content">
      <span class="info-box-text">AbbVie Inc.</span>
      <span class="info-box-number">Senior Manager, Statistical Programming</span>
      <p> Lake County . . . Illinois, Retrieved 3 day(s) ago</p>
    </div>
  </div>
</a></div>

ghost avatar Feb 19 '18 04:02 ghost

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?

wch avatar Feb 20 '18 16:02 wch

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>

ghost avatar Feb 20 '18 17:02 ghost

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.

AzlinII avatar Jul 20 '18 15:07 AzlinII

Got same issue here

clbenoit avatar Jan 22 '21 15:01 clbenoit