rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
893 stars 300 forks source link

Stacking fontawesome icons in the menuItem #110

Open danwwilson opened 8 years ago

danwwilson commented 8 years ago

When attempting to stack icons in the menuItem I encounter the error "Error: Expected tag to be of type i"

Code used is: menuItem("test stack", tabName = "t_donorTrends", icon = span(class="fa-user fa-plus", icon("user", "fa-stack-1x"), icon("ban", "fa-stack-2x")))

I presume that this is because the icon = expects to see icon = icon(...) rather than a span(). Unfortunately if I ditch the icon = ... it doesn't apply an icon to my menuItem

Any thoughts how we can bring this useful feature to shinydashboard?

dmpe commented 8 years ago

Hi @danwwilson , Sorry for late answer. I am trying to reproduce your example and yes i got that message too with this https://gist.github.com/dmpe/0e3bdf2ec802fd8aaabe.

library(devtools)
devtools::install_github("rstudio/shiny")
    menuItem(
      "test stack",
      icon = icon("fa fa-user-plus"),
      icon("user", "fa-stack-1x"),
      icon("ban", "fa-stack-2x")
    )

sh2i shi

As they & you write the icon must be inside <i> tag thus span is will not work. But you can also try something like:

    menuItem(
      "test stack",
      icon = icon("fa fa-user-plus"),
      icon("user", "fa-stack-1x"),
      icon("ban", "fa-stack-2x"),
      span(shiny::icon("fa fa-user-plus"))
    )

to produce

sh3i. Does that help you ?

Source: https://github.com/rstudio/shinydashboard/blob/2286c18e92548f26c8bf67e5e4cc359b3627db6d/R/dashboardHeader.R#L121

danwwilson commented 8 years ago

My approach to stacking was to circumvent the missing icons from FontAwesome V4.2. However it would be great if it was possible to stack icons against the menuItem within shinydashboard

dmpe commented 8 years ago

Could you maybe provide some example, please? Thank you!