Search code examples
rshinytaglist

Black dot header notification using uiOutput and renderUI


When I want to use a Left sided notification using renderUI..somehow a black dot is appearing, which isnt the if you just place the leftUI in the UI section. Why?

I had the same issue in the UI when I used tags$li though I solved it using tagList, see: R Shiny increase header height remove dot next to navigation icon

and

R shiny image and removing black dot

but puting it in renderUI it reappears

library(shiny)
library(bs4Dash)

ui <- dashboardPage(
  header = dashboardHeader(
    uiOutput("left_ui")
  ),
  sidebar = dashboardSidebar(),
  body = bs4DashBody(
    uiOutput("moreControls")
  ),
  controlbar = uiOutput("controlbarmen")
)

server <- function(input, output) {
  
  output$left_ui = renderUI({
    
    leftUi = tagList(
      dropdownMenu(type = "notifications", badgeStatus = "danger",
                   notificationItem(
                     text = "Test",
                     icon("circle-exclamation"),
                     status = "danger")
      )
    )
  })
  
  output$moreControls <- renderUI({
    tagList(
      sliderInput("n", "N", 1, 1000, 500),
      textInput("label", "Label")
    )
  })
  
  output$controlbarmen = renderUI({
    NULL
      )
  })
}
shinyApp(ui, server)
}

enter image description here


Solution

  • Do:

      header = dashboardHeader(
        leftUi = uiOutput("left_ui")
      )
    

    and it disappears.

    The leftUi in your renderUI is useless.