Old_Mortality
Old_Mortality

Reputation: 519

Why is my shinydashboard custom css not working?

I am following these instructions:

https://rstudio.github.io/shinydashboard/appearance.html

But I get this error:

Warning: Error in $: $ operator is invalid for atomic vectors
  55: dots_list
  54: tags$section
  51: dashboardSidebar

This is my code:

library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    # Custom CSS to hide the default logout panel
    tags$head(tags$style(HTML('.shiny-server-account { display: none; }'))),

    # The dynamically-generated user panel
    uiOutput("userpanel")
  ),
  dashboardBody()
)

server <- function(input, output, session) {
  output$userpanel <- renderUI({
    # session$user is non-NULL only in authenticated sessions
    if (!is.null(session$user)) {
      sidebarUserPanel(
        span("Logged in as ", session$user),
        subtitle = a(icon("sign-out"), "Logout", href="__logout__"))
    }
  })
}

shinyApp(ui, server)

Just as in the instructions. The error is in this line

tags$head(tags$style(HTML('.shiny-server-account { display: none; }'))),

Because if I take that out, the error disappears.

I have had code similar to this working for a long time, but it has suddenly stopped working. Any help is much appreciated.

Upvotes: 0

Views: 401

Answers (1)

Old_Mortality
Old_Mortality

Reputation: 519

The problem has disappeared after I reinstalled Rstudio. I have no idea why.

Upvotes: 0

Related Questions