Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shinydashboard some Font Awesome Icons Not Working

When using shinydashboard I find that some icons seem to work while some don't. In the below example, the battery-full icon doesn't work while the clock-o icon works fine. I'm unable to figure out why this should happen.

library(shiny)
library(shinydashboard)

header <- dashboardHeader(title="Some Icons Not Working?")

# No sidebar --------------------------------------------------------------

sm <- sidebarMenu(

  sm <- sidebarMenu(
    menuItem(
      text="asdf",
      tabName="asdfasdf",
      icon=icon("battery-full")),
    menuItem(
      text="qwer",
      tabName="qwerqwer",
      icon=icon("clock-o"))
  )
)

sidebar <- dashboardSidebar(sm)

# Compose dashboard body --------------------------------------------------

body <- dashboardBody(

  tabItems(

  )
)

# Setup Shiny app UI components -------------------------------------------

ui <- dashboardPage(header, sidebar, body, skin="black")

# Setup Shiny app back-end components -------------------------------------

server <- function(input, output) {


}

# Render Shiny app --------------------------------------------------------

shinyApp(ui, server)
like image 239
TheComeOnMan Avatar asked Sep 21 '15 01:09

TheComeOnMan


People also ask

Why some of the Font Awesome icons does not show?

Are you using Font Awesome Free or Pro? - Some icons are only available in Font Awesome Pro. Double-check that the icon you want is in the version of Font Awesome you're referencing and using. Also, make sure you are using and referencing the right style prefix and supporting files to use Pro icons.

How do I make Font Awesome icons accessible?

If an icon is not an interactive element The simplest way to provide a text alternative is to use the aria-hidden="true" attribute on the icon and to include the text with an additional element, such as a <span> , with appropriate CSS to visually hide the element while keeping it accessible to assistive technologies.

Are Font Awesome icons copyright free?

Font Awesome is fully open source and is GPL friendly. You can use it for commercial projects, open source projects, or really just about whatever you want. Attribution is no longer required as of Font Awesome 3.0 but is much appreciated: "Font Awesome by Dave Gandy - http://fontawesome.io".


1 Answers

Ok, I think the new ones in version 4.4 are not updated. You can probably request shiny team to update them and they will do it very easily. Alternatively you can do it yourself by downloading them and replacing the previous content...

1. Go to the Font Awesome download page and get it enter image description here

2. Locate your font awesome folder where you installed shiny package. This should be somewhere like here ~\Documents\R\win-library\3.1\shiny\www\shared\font-awesome

3. Replace the content of this folder with new contents (you can delete the previous content if you want). Below is what I put in there enter image description here

4. Now your app should work fine with new fonts enter image description here

like image 77
Pork Chop Avatar answered Nov 20 '22 12:11

Pork Chop