Reputation: 496
Can I add a rho (Greek letter small) as an icon to a value box in RShiny? For example, with the following code snippet, I have created a value box that has the € symbol as an icon:
valueBox(winterMean, subtitle = "Mean Winter", color = "black", icon = icon("euro-sign"))
This gives the following value box:
How can I replace the € symbol by a small rho?
Upvotes: 2
Views: 706
Reputation: 56149
We can add custom Greek letters using Unicode Character "ρ" (U+03C1) through custom css, see example:
Our example rmd file:
---
title: "My Rho"
output:
flexdashboard::flex_dashboard:
css: styles.css
---
```{r}
library(flexdashboard)
valueBox(42, caption = "My Rho", icon = "fa-rho")
```
And additional styles.css file:
.fa-rho:before {
font-weight: 700;
content: '\03c1';
}
Output:
Note: For my test I kept css file in the same folder as rmd file, but it could be in any subfolder, then we need to define the full path in rmd, e.g.: resources/css/styles.css
.
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
includeCSS("styles.css"),
valueBox(42, "My Rho", icon = icon("rho")),
)
)
server <- function(input, output) { }
shinyApp(ui, server)
Output:
Upvotes: 1