0

I have a R Shiny dashboard with a higher header (wel title cause the logo is set to height = "55px") ...however the pin of the controlbar is than under the header. How to fix this? This is particulary with disabled dashboardSidebar

library(shiny)
library(shinydashboard)

ui <- 
  dashboardPage(
    title = "Test",
    header = dashboardHeader(
      title = a(target="_blank", href = 'https://www.google.com',
                img(src = 'https://img.freepik.com/free-icon/search_318-265146.jpg', title = "Test", height = "55px"),
                style = "padding-top:10px; padding-bottom:10px; padding-left:10px;")
    ),
    sidebar = dashboardSidebar(disable = T),
    body = dashboardBody(),
    controlbar =   dashboardControlbar(
      width = 300,
      pinned  = T,
    )
  )
  
  server <- function(input, output) {}
  
  shinyApp(ui, server)

enter image description here

H. berg
  • 471
  • 1
  • 3
  • 11
  • 1
    With `height = "40px"` in the title image you can avoid this. If you absolutely need 55px in the image, then a quick hack can be adding a top margin for the control sidebar in your css: `.control-sidebar {margin-top: 15px;}`. – MalditoBarbudo Mar 06 '23 at 08:25
  • Also, in the reproducible example, you need to add `library(bs4Dash)` as it doesn't work without it – MalditoBarbudo Mar 06 '23 at 08:27
  • Thx....where in the code should I add the top margin? Within controlbar =? Or within the body? And what tag do I need? Like this: `tags$style(".control-sidebar {margin-top: 15px;}")` – H. berg Mar 06 '23 at 08:32
  • Just added it to controlbar = ....works!! – H. berg Mar 06 '23 at 08:45

0 Answers0