Closed e-leo closed 1 year ago
How do you insert icon in flexdashboard ? Using the navbar
field ?
Which version of rmarkdown are you using currently ?
We've made a few changes for new prefix in rmarkdown but we may have missed something there, or in flexdashboard directly.
It is possible that flexdashboard does not yet use the prefix and it should https://github.com/rstudio/flexdashboard/blob/82e99271c04d099779534587083cc07f406c780b/R/flex_dashboard.R#L549-L592
Keeping FA V4 and V5 compatible is also something we need to improve in rmarkdown side (https://github.com/rstudio/rmarkdown/pull/1994)
Hello, thank you for the prompt reply! These are not icons that I'm inserting manually, these are included based on the header I've set at the beginning of my script:
title: "Uninsured Analysis" output: flexdashboard::flex_dashboard: theme: yeti orientation: rows vertical_layout: scroll logo: data/mhbelogo.png social: menu source: embed includes: after_body: footer.html bibliography: citations.bib runtime: shiny
Rmarkdown version says 2.7, flexdashboard says version 0.5.2 and my base R version is 4.0.4, if that helps. Please let me know if you need any more details! Thank you!
the current code use the fa prefix:
icon = "fa-twitter"
font awesome had some changes recently https://fontawesome.com/how-to-use/on-the-web/referencing-icons/basic-use and now the free available icon have a fas (solid) prefix fas instead of fa try to run this and see what works or not in your rstudio viewer
shiny::icon("fa-twitter"), #does not work shiny::icon("twitter"), #works shiny::icon("fas fa-twitter")#works
@e-leo thanks for sharing.
I can't check directly as I don't have permission to open the link you shared to your dashboard. I would like to see what is the potential error in the browser console.
Currently, after updating to currently dev version of flexdashboard I can't reproduc with a simple example
---
title: "Uninsured Analysis"
output:
flexdashboard::flex_dashboard:
theme: yeti
social: menu
source: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
I got this correctly when I knit the above document
![image](https://user-images.githubusercontent.com/6791940/116374046-3c52cd00-a80e-11eb-99b3-7510d856bdc5.png)
Can you check your packages versions and try updating ?
@smouksassi yes Fontawesome added prefix but this should be taken into accound with v4 compatibility. **shiny** is not supposed to be involved here. only **flexdashboard** and maybe **rmarkdown**
Hm. Could the issue be that I have the shiny rendering call? Originally this dashboard was going to have shiny features, but I ended up using just flexdashboard. Should I remove that call to runtime:shiny? I've checked all the versions and I'm supposedly using the latest of each. I will try updating flexdashboard to the dev version and see if that helps and will update this comment if it resolves the issue. Thank you!
Let me try with runtime shiny and see if I can reproduce
It still works for me and I can see the icons with this small example:
---
title: "Uninsured Analysis"
output:
flexdashboard::flex_dashboard:
self_contained: false
theme: yeti
social: menu
source: embed
runtime: shiny
---
```{r global, include=FALSE}
# load data in 'global' chunk so it can be shared by all users of the dashboard
library(datasets)
data(faithful)
Waiting time between eruptions and the duration of the eruption for the Old Faithful geyser in Yellowstone National Park, Wyoming, USA.
selectInput("n_breaks", label = "Number of bins:",
choices = c(10, 20, 35, 50), selected = 20)
sliderInput("bw_adjust", label = "Bandwidth adjustment:",
min = 0.2, max = 2, value = 1, step = 0.2)
renderPlot({
hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks),
xlab = "Duration (minutes)", main = "Geyser Eruption Duration")
dens <- density(faithful$eruptions, adjust = input$bw_adjust)
lines(dens, col = "blue")
})
I am using last development version of packages installed from github.
Removing runtime:shiny and using the dev version of flexdashboard (install.packages("flexdashboard", type="source" was tried first, then using the devtools::install_github() was also tried) did not resolve the issue. I'm posting a link to the raw source code for my dashboard here since you're unable to access my dashboard to view it:
I tried to reproduce this issue but could not. I believe that the flexdashboard's fontawesome dependency comes from rmarkdown::html_dependency_font_awesome() which includes a backwards-compatibility layer that allows flexdashboard to continue to use older fontawesome icon classes.
I'm going to close this for now; if anyone runs into a similar problem, please open a new issue. Thank you!
FWIW we are moving the rmarkdown HTML dependency to fontawesome to use the fontawesome R package. This will be useful to have any tool using rmarkdown dependencies to use the same R package for icons. This should be for compatibility and issue.
Anyhow, I believe this is indeed working better now since we've made updates in rmarkdown
Thanks
I have a simple flexdashboard (https://www.marylandhbe.com/wp-content/docs/COVID_Uninsured_Analysis_Dashboard.html) which has the social share and source code buttons in the top right corner. As you can see, it compiled and generated just fine a few weeks ago. I updated some data and recompiled and now the social share and source code icons are showing as empty white boxes: I've attempted the fix listed here , putting that code first before anything else in my script and also tried putting it after my library calls and I am still getting the icon display issue. All of my leaflet maps are also zoomed out, despite none of the code being different. I've gone over my script line by line and do not see ANY differences. I was able to fix all the font-awesome icons I use elsewhere on the page by adding the fas namespace, but I have no idea how to force flexdashboard/rmarkdown to use that new namespace. Any assistance would be much appreciated.