8

The following css style corresponds to the menu icon in a shiny dashboard. I want to change it. I tried with tags$head(tags$style.. in the body, but it didn't work. Any ideas?

.main-header .sidebar-toggle:before {
    content: "\f0c9";
}
Ferroao
  • 3,042
  • 28
  • 53

1 Answers1

5

You need to escape the \:

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    tags$head(tags$style(HTML('
      .main-header .sidebar-toggle:before {
        content: "\\f0c7";}')))
    )
)

server <- function(input, output) { }

shinyApp(ui, server)

I also generally wrap the CSS in HTML to prevent escaping of other HTML characters.

NicE
  • 21,165
  • 3
  • 51
  • 68
  • This looks very nice, but I need to replace the menu icon with an image, say `mylogo.png`. How can this be done? – panman Mar 14 '19 at 15:38
  • @panman https://mediatemple.net/blog/tips/creating-implementing-icon-font-tutorial/ – Ferroao Feb 06 '20 at 13:38