Pinkette
Pinkette

Reputation: 5

Add picture in dashboardHeader

I need your help for my R shiny application. I want to add a logo near the title in dashboardHeader. The logo don't display in the page. Can you help me ? Thanks in advance. This is the code :

library(shiny)
library(shinydashboard)

shinyApp(
  
  ui = dashboardPage(
    dashboardHeader(title = tags$img(src='logo.JPG', height = '60', width ='60')),
    dashboardSidebar(),
    dashboardBody()
),
server = function(input, output) {}
)

Upvotes: 0

Views: 2987

Answers (2)

Mriti Agarwal
Mriti Agarwal

Reputation: 216

Just create a new folder with the name "www" in the same directory as your script and add your picture in that

Upvotes: 2

Jack
Jack

Reputation: 156

Your code seems to work just fine. Try this for example with an image from the internet(I just put google as an example).

library(shiny)
library(shinydashboard)

shinyApp(
  
  ui = dashboardPage(
    dashboardHeader(title = tags$img(src='https://cdn.vox-cdn.com/thumbor/Ous3VQj1sn4tvb3H13rIu8eGoZs=/0x0:2012x1341/1400x788/filters:focal(0x0:2012x1341):format(jpeg)/cdn.vox-cdn.com/uploads/chorus_image/image/47070706/google2.0.0.jpg', height = '60', width ='60')),
    dashboardSidebar(),
    dashboardBody()
  ),
  server = function(input, output) {}
)

Upvotes: 1

Related Questions