shiny.semantic icon indicating copy to clipboard operation
shiny.semantic copied to clipboard

Insert shiny.semantic card into flexdashboard

Open benjaminrobinson opened this issue 6 years ago • 4 comments

Hi, team! I want to include some cards I've built using shiny.semantic into a flexdashboard that I'm building with a shiny runtime. Here is my code that works and I want to bring into my flexdashboard:

library(shiny)
library(shiny.semantic)
uirender(
 div(class="demo",
  div(class="ui card",
    div(class="content",
    tags$b("Contact Information: "),br(),
    "Name",br(),
    "Address"),
      div(class="extra content")
      )
  )
)

However, when I try to run it in the flexdashboard context, with this code:

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    runtime: shiny
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(shiny.semantic)
library(shiny)

Column {data-width=650}

Card A

renderUI({
uirender(
 div(class="demo",
  div(class="ui card",
    div(class="content",
    tags$b("Contact Information: "),br(),
    "Name",br(),
    "Address"),
      div(class="extra content")
      )
  )
)
})

I get this error message:

Warning: Error in addResourcePath: addResourcePath called with invalid prefix; please see documentation.

Any idea what this error might be referring to? I want to be able to show a set of cards with reactive output in them but I can't seem to get over this issue. Thank you for developing this. Very cool!

benjaminrobinson avatar Dec 05 '17 21:12 benjaminrobinson

Just replying to see if anyone has a response...it would be greatly appreciated!

benjaminrobinson avatar Dec 11 '17 16:12 benjaminrobinson

Hi Benjamin,

Good question. The standard use of this package was intended to be Shiny. Anyway it should be possible to use it with markdown as well.

The problematic chunk of code is .onLoad function in shiny.semantic/R/shiny.R. We need to take a closer look at how dependencies are resolved within Rmarkdown files. We'll try to take a look as soon as possible. If you want to try to take a look at how other similar packages are resolving static js/css files that would be a great help!

Thanks, Filip

filipstachura avatar Dec 12 '17 10:12 filipstachura

Hi folks, around the time of your discussion I build a Rmd file with semantic UI components from the shiny.semantic package website. Maybe you are interested in the code on github. Another way could be to source semantic UI directly with html. Probably the best option is to use semantic.dashboard instead of flexdashboard.

systats avatar Apr 25 '18 13:04 systats

Wow, this is great!

One problem that I see is that semantic.dashboard uses Shiny and needs Shiny server. We don't generate static HTML as flexdashboard does.

filipstachura avatar Apr 25 '18 14:04 filipstachura