Appsilon / shiny.semantic

Shiny support for powerful Fomantic UI library.
http://appsilon.github.io/shiny.semantic
Other
502 stars 97 forks source link

Insert shiny.semantic card into flexdashboard #56

Open benjaminrobinson opened 6 years ago

benjaminrobinson commented 6 years ago

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 commented 6 years ago

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

filipstachura commented 6 years ago

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

systats commented 6 years ago

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.

filipstachura commented 6 years ago

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.